Click here to Skip to main content
15,913,225 members
Home / Discussions / C#
   

C#

 
AnswerRe: need coding Pin
Colin Angus Mackay3-May-07 0:48
Colin Angus Mackay3-May-07 0:48 
GeneralRe: need coding Pin
Arun.Immanuel3-May-07 2:47
Arun.Immanuel3-May-07 2:47 
AnswerRe: need coding Pin
Frank Kerrigan3-May-07 2:54
Frank Kerrigan3-May-07 2:54 
Questioncomputer shop management with sql server connectivity project Pin
billu98909149603-May-07 0:22
billu98909149603-May-07 0:22 
AnswerRe: computer shop management with sql server connectivity project Pin
Pete O'Hanlon3-May-07 0:54
mvePete O'Hanlon3-May-07 0:54 
GeneralRe: computer shop management with sql server connectivity project Pin
Paul Conrad3-May-07 4:13
professionalPaul Conrad3-May-07 4:13 
AnswerRe: computer shop management with sql server connectivity project Pin
darkelv3-May-07 1:53
darkelv3-May-07 1:53 
QuestionCall to Methods Pin
Subrahmanyam K3-May-07 0:16
Subrahmanyam K3-May-07 0: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 0:31
Brady Kelly3-May-07 0:31 
GeneralRe: Call to Methods Pin
Subrahmanyam K3-May-07 0:46
Subrahmanyam K3-May-07 0:46 
GeneralRe: Call to Methods Pin
soneliso3-May-07 2:36
soneliso3-May-07 2:36 
AnswerRe: Call to Methods Pin
J. Dunlap3-May-07 0:58
J. Dunlap3-May-07 0:58 
GeneralRe: Call to Methods Pin
Subrahmanyam K3-May-07 1:35
Subrahmanyam K3-May-07 1:35 
AnswerRe: Call to Methods Pin
AFSEKI7-May-07 5:23
AFSEKI7-May-07 5:23 
Questionprinting a crystal report Pin
rkherath2-May-07 23:29
rkherath2-May-07 23:29 
AnswerRe: printing a crystal report Pin
soneliso3-May-07 0:24
soneliso3-May-07 0:24 
GeneralRe: printing a crystal report Pin
rkherath3-May-07 0:38
rkherath3-May-07 0:38 
AnswerRe: printing a crystal report Pin
darkelv3-May-07 1:56
darkelv3-May-07 1:56 
QuestionGet Application directory from console program Pin
Soundman32.22-May-07 23:23
Soundman32.22-May-07 23:23 
GeneralRe: Get Application directory from console program Pin
Soundman32.22-May-07 23:45
Soundman32.22-May-07 23:45 
GeneralRe: Get Application directory from console program Pin
wurzel_cidermaker3-May-07 2:02
wurzel_cidermaker3-May-07 2:02 
AnswerRe: Get Application directory from console program Pin
Brady Kelly3-May-07 0:01
Brady Kelly3-May-07 0:01 
GeneralRe: Get Application directory from console program Pin
Soundman32.23-May-07 0:51
Soundman32.23-May-07 0:51 
AnswerRe: Get Application directory from console program Pin
PIEBALDconsult3-May-07 6:28
mvePIEBALDconsult3-May-07 6:28 
AnswerRe: Get Application directory from console program Pin
Stefan Prodan3-May-07 12:55
Stefan Prodan3-May-07 12: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.