|
-
June 19th, 2008, 12:57 PM
#1
Late Binding - Help invoking a method please.
Hi,
I am using reflection / late binding to invoke a method. This all works correctly as long as my paramater types match exactly the parameter types for the method.
However I need it to attempt to parse the supplied parameters and convert their types to match that of the method being invoked. I guess its possible through setting some flags on the Binder ?? however I cannot get this to work.
Here is my code so far (which will error if an incorrect paramater type is passed)
object[] methodParams = { "x", "y" };
Type thisType = this.GetType();
MethodInfo methodToCall = thisType.GetMethod("MyMethod");
methodToCall.Invoke(this, methodParams);
Thanks,
Martyn.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|