Click here to Skip to main content
15,845,598 members
Home / Discussions / C#
   

C#

 
AnswerRe: need coding Pin
Colin Angus Mackay3-May-07 1:48
Colin Angus Mackay3-May-07 1:48 
GeneralRe: need coding Pin
Arun.Immanuel3-May-07 3:47
Arun.Immanuel3-May-07 3:47 
AnswerRe: need coding Pin
Frank Kerrigan3-May-07 3:54
Frank Kerrigan3-May-07 3:54 
Questioncomputer shop management with sql server connectivity project Pin
billu98909149603-May-07 1:22
billu98909149603-May-07 1:22 
AnswerRe: computer shop management with sql server connectivity project Pin
Pete O'Hanlon3-May-07 1:54
subeditorPete O'Hanlon3-May-07 1:54 
GeneralRe: computer shop management with sql server connectivity project Pin
Paul Conrad3-May-07 5:13
professionalPaul Conrad3-May-07 5:13 
AnswerRe: computer shop management with sql server connectivity project Pin
darkelv3-May-07 2:53
darkelv3-May-07 2:53 
QuestionCall to Methods Pin
Subrahmanyam K3-May-07 1:16
Subrahmanyam K3-May-07 1:16 
Hi Friends,

How can I handle the call to specific methods based on a string value without comapring the string value using any of the control statements .
The requirement is explained as follows:

I have 3 methods here.

1. CallMethod(String s)
2. ProcessAgencyDataTable()
3. ProcessAuthorityDataTable()

Now, I should be able to call the method ProcessAgencyDataTable() when (s="Agency") for CallMethod(String s) and
ProcessAuthorityDataTable() when (s="Authority") for CallMethod(String s).

I should achieve this without using any of the control statements (like if, if-else, switch etc).
The CallMethod() should be able to call the specific method based on the value of s parameter.
Note: There will be some similarity in the Method names that will be called.

        public void CallMethod(String s)<br />
        {<br />
            switch (s)<br />
            {<br />
                   case "Agency":<br />
	          ProcessAgencyDataTable();<br />
                       break;<br />
                   case "Authority":<br />
	         ProcessAuthorityDataTable();<br />
                       break;<br />
                   default:<br />
                       break;<br />
            }<br />
        }<br />
<br />
        private void ProcessAgencyDataTable()<br />
        {<br />
           // Implementation here<br />
        }<br />
<br />
        private void ProcessAuthorityDataTable()<br />
        {<br />
           // Implementation here<br />
        }


Thanks for some suggestions.




Subrahmanyam K

AnswerRe: Call to Methods Pin
Brady Kelly3-May-07 1:31
Brady Kelly3-May-07 1:31 
GeneralRe: Call to Methods Pin
Subrahmanyam K3-May-07 1:46
Subrahmanyam K3-May-07 1:46 
GeneralRe: Call to Methods Pin
soneliso3-May-07 3:36
soneliso3-May-07 3:36 
AnswerRe: Call to Methods Pin
J. Dunlap3-May-07 1:58
J. Dunlap3-May-07 1:58 
GeneralRe: Call to Methods Pin
Subrahmanyam K3-May-07 2:35
Subrahmanyam K3-May-07 2:35 
AnswerRe: Call to Methods Pin
AFSEKI7-May-07 6:23
AFSEKI7-May-07 6:23 
Questionprinting a crystal report Pin
rkherath3-May-07 0:29
rkherath3-May-07 0:29 
AnswerRe: printing a crystal report Pin
soneliso3-May-07 1:24
soneliso3-May-07 1:24 
GeneralRe: printing a crystal report Pin
rkherath3-May-07 1:38
rkherath3-May-07 1:38 
AnswerRe: printing a crystal report Pin
darkelv3-May-07 2:56
darkelv3-May-07 2:56 
QuestionGet Application directory from console program Pin
Soundman32.23-May-07 0:23
Soundman32.23-May-07 0:23 
GeneralRe: Get Application directory from console program Pin
Soundman32.23-May-07 0:45
Soundman32.23-May-07 0:45 
GeneralRe: Get Application directory from console program Pin
wurzel_cidermaker3-May-07 3:02
wurzel_cidermaker3-May-07 3:02 
AnswerRe: Get Application directory from console program Pin
Brady Kelly3-May-07 1:01
Brady Kelly3-May-07 1:01 
GeneralRe: Get Application directory from console program Pin
Soundman32.23-May-07 1:51
Soundman32.23-May-07 1:51 
AnswerRe: Get Application directory from console program Pin
PIEBALDconsult3-May-07 7:28
mvePIEBALDconsult3-May-07 7:28 
AnswerRe: Get Application directory from console program Pin
Stefan Prodan3-May-07 13:55
Stefan Prodan3-May-07 13:55 

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.