Click here to Skip to main content
15,905,508 members
Home / Discussions / C#
   

C#

 
GeneralRe: overloading a construtor Pin
sneezesnoeze28-May-14 11:21
sneezesnoeze28-May-14 11:21 
GeneralRe: overloading a construtor Pin
Pete O'Hanlon28-May-14 12:47
mvePete O'Hanlon28-May-14 12:47 
AnswerRe: overloading a construtor Pin
Eddy Vluggen28-May-14 11:14
professionalEddy Vluggen28-May-14 11:14 
AnswerRe: overloading a construtor Pin
Matt T Heffron28-May-14 11:48
professionalMatt T Heffron28-May-14 11:48 
AnswerRe: overloading a construtor Pin
BobJanova29-May-14 1:01
BobJanova29-May-14 1:01 
GeneralRe: overloading a construtor Pin
sneezesnoeze2-Jun-14 10:32
sneezesnoeze2-Jun-14 10:32 
QuestionSong Organizer c# Pin
AtmotechDejan28-May-14 9:55
AtmotechDejan28-May-14 9:55 
AnswerRe: Song Organizer c# Pin
Mycroft Holmes28-May-14 13:00
professionalMycroft Holmes28-May-14 13:00 
QuestionMethod for erase textboxes by clicking a button Pin
Vexy28-May-14 7:19
Vexy28-May-14 7:19 
AnswerRe: Method for erase textboxes by clicking a button Pin
Eddy Vluggen28-May-14 7:22
professionalEddy Vluggen28-May-14 7:22 
GeneralRe: Method for erase textboxes by clicking a button Pin
Vexy28-May-14 7:28
Vexy28-May-14 7:28 
GeneralRe: Method for erase textboxes by clicking a button Pin
Eddy Vluggen28-May-14 7:51
professionalEddy Vluggen28-May-14 7:51 
AnswerRe: Method for erase textboxes by clicking a button Pin
Pete O'Hanlon28-May-14 8:24
mvePete O'Hanlon28-May-14 8:24 
GeneralRe: Method for erase textboxes by clicking a button Pin
Vexy28-May-14 8:36
Vexy28-May-14 8:36 
GeneralRe: Method for erase textboxes by clicking a button Pin
Eddy Vluggen28-May-14 9:18
professionalEddy Vluggen28-May-14 9:18 
AnswerRe: Method for erase textboxes by clicking a button Pin
osamashatnawe29-May-14 0:27
osamashatnawe29-May-14 0:27 
QuestionHow to find interfaces in code programmatically Pin
Frygreen28-May-14 6:31
Frygreen28-May-14 6:31 
Dear reader,

at startup of my program I want to find all instances/classes, which support an special interface.

Example:
I have class A, which supports interface "void someFct()"
I have class B, which supports interface "void someFct()"

At startup of my program, I want to call both functions/interfaces without registering them before.

I hope you can understand, what I want?

Have a nice day

############### update ########################

I try to describe my problem better

My app reads a lot of data-sources and then it executes a list of ReportInstances, where each report creates excel-reports/sheets. This takes roughly 10 minutes. Each individual report checks/validates its input/config/... before it executes its own business-logic. In practice it happens, that in worst case the last report detects an error at its validation and the program stops. This is very annoying.

Simplyfied code here:
C#
<pre>void CreateReport( params here ) {
   CreateReport_1(par);
   CreateReport_2(par);
   .......
}


My idea is: Do validation, before starting the single reports

Solution 1: Register all validation-delegates and execute them before starting the reports

This kind of code is
C#
void CreateReport( some params ) {
    // GetValidationDelegate() are static functions
    myValidationList.Add( Reporter_1.GetValidationDelegate());
    myValidationList.Add( Reporter_2.GetValidationDelegate());
  
    foreach (validationDelegate in myValidationList) {
          execute validationDelegate;
    }

   // Validation is done, start now with reports
   CreateReport_1(par);
   CreateReport_2(par);
   .....
}


This is easy, but it has the disadvantage, that each time I add a new reporter I have to change my "registration-code". It is some kind of maintenance problem.

Solution 2: Do it "more automatic", this is what I am looking for

The kind of code I am looking for is

C#
void CreateReport( some params ) {
    myValidationList = GetAllAvailableValidationDelegates()
    foreach (validationDelegate in myValidationList) {
          execute validationDelegate;
    }
   // Validation is done, start now with reports
   CreateReport_1(par);
   .....
}


I am looking for the code of "GetAllAvailableValidationDelegates()", which "parses" automatically all available classes/instances in my program and looks for such delegates

modified 29-May-14 0:00am.

AnswerRe: How to find interfaces in code programmatically Pin
Richard MacCutchan28-May-14 6:40
mveRichard MacCutchan28-May-14 6:40 
AnswerRe: How to find interfaces in code programmatically Pin
Kornfeld Eliyahu Peter28-May-14 6:41
professionalKornfeld Eliyahu Peter28-May-14 6:41 
AnswerRe: How to find interfaces in code programmatically Pin
Eddy Vluggen28-May-14 7:21
professionalEddy Vluggen28-May-14 7:21 
AnswerRe: How to find interfaces in code programmatically Pin
jschell28-May-14 8:46
jschell28-May-14 8:46 
AnswerRe: How to find interfaces in code programmatically Pin
BobJanova29-May-14 1:20
BobJanova29-May-14 1:20 
QuestionLoading and unloading assemblies using reflection Pin
nitin_ion28-May-14 1:38
nitin_ion28-May-14 1:38 
SuggestionRe: Loading and unloading assemblies using reflection Pin
Richard MacCutchan28-May-14 2:46
mveRichard MacCutchan28-May-14 2:46 
AnswerRe: Loading and unloading assemblies using reflection Pin
Rob Philpott28-May-14 4:52
Rob Philpott28-May-14 4:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.