Calling a Method Using Reflection

V

Vikram

Hi,

How do I call a method which takes a ref parameter using Reflection ??

Thanks,
Vikram
 
M

Mattias Sjögren

Vikram,
How do I call a method which takes a ref parameter using Reflection ??

The same way you call methods without ref parameters. Do you have any
problems with it?



Mattias
 
J

Jon Skeet

Vikram said:
How do I call a method which takes a ref parameter using Reflection ??

There's a good example in MSDN under
Type.InvokeMember Method
(String, BindingFlags, Binder, Object, Object[])

The constructor there is called with a ref parameter. Basically, the
value in the parameter array is replaced with the final value, if you
see what I mean.
 
V

Vikram

Hi,

Forgot to mention. The method is overloaded.
Can u point me to a sample for calling overloaded methods and with the
method having a ref or out
parameter.

Thanks,
Vikram


Jon Skeet said:
Vikram said:
How do I call a method which takes a ref parameter using Reflection ??

There's a good example in MSDN under
Type.InvokeMember Method
(String, BindingFlags, Binder, Object, Object[])

The constructor there is called with a ref parameter. Basically, the
value in the parameter array is replaced with the final value, if you
see what I mean.
 
J

Jon Skeet

Vikram said:
Forgot to mention. The method is overloaded.
Can u point me to a sample for calling overloaded methods and with the
method having a ref or out parameter.

The method being overloaded makes no difference when you *call* it - it
just means that you need to be careful when supplying the parameter
types to Type.GetMethod.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top