Home All Groups Group Topic Archive Search About

Loading method on runtime

Author
22 Mar 2006 2:01 PM
Sudhee
I am storing method names in one xml file , on run time i read method name
for ex class1.Method1  , I want invoke this method is there any facility in
system.reflection to load the methods like we load assemblies using
assembly.load. I would have instantiated the class before reading xml , Is
there any way I can load method on runtime.
Thanks in Advance
Sudheendra

Author
22 Mar 2006 2:56 PM
Boas Enkler
HI
I'm not quite sure if  I understand you right

but isn't InvokeMember the thing that should help?
Author
22 Mar 2006 3:07 PM
Sudhee
Hi,
Sorry I did not put it clearly. I have instatiated the Class 1 , it has let
us say method 1, Method2 . In my application I have xml file which has some
info and methodname like
event  TagName="TextName" 
         type="System.Windows.Forms.KeyPressEventArgs" 
         valid="Class1.Ischar"  .
I read this file run time and get method name ie valid --- class1.ischar to
a string . Now how to use this to invoke  method presenlty I am doing like
this
Select case methodname
case "Class1.Ischar"
call Class1.Ischar

I want to avoid this case structure  and directly call the method something
like
call  <methodname> 'it contains Class1.Ischar
is this possible
thanks in advance
Sudhee

Show quote
"Boas Enkler" wrote:

> HI
> I'm not quite sure if  I understand you right
>
> but isn't InvokeMember the thing that should help?
>
Author
22 Mar 2006 3:27 PM
Laura T.
Check out the documentation of Delegate class.
It has all you need.

Laura.

Show quote
"Sudhee" <Sud***@discussions.microsoft.com> ha scritto nel messaggio
news:1FBAC8A0-EEF2-476E-8225-0EDF10E7A477@microsoft.com...
>
> Hi,
> Sorry I did not put it clearly. I have instatiated the Class 1 , it has
> let
> us say method 1, Method2 . In my application I have xml file which has
> some
> info and methodname like
> event  TagName="TextName"
>         type="System.Windows.Forms.KeyPressEventArgs"
>         valid="Class1.Ischar"  .
> I read this file run time and get method name ie valid --- class1.ischar
> to
> a string . Now how to use this to invoke  method presenlty I am doing like
> this
> Select case methodname
> case "Class1.Ischar"
> call Class1.Ischar
>
> I want to avoid this case structure  and directly call the method
> something
> like
> call  <methodname> 'it contains Class1.Ischar
> is this possible
> thanks in advance
> Sudhee
>
> "Boas Enkler" wrote:
>
>> HI
>> I'm not quite sure if  I understand you right
>>
>> but isn't InvokeMember the thing that should help?
>>

AddThis Social Bookmark Button