J
Joel
I need to get a reference to a method in my currently running class by the
method name. I don't want a MethodInfo object; I want an actual reference to
the method. Basically I'm trying to programatically load a delegate via the
method name that should be invoked. For example the "normal" way of doing it
is:
internal delegate void MyDelegate(DataSet ds); //delcare my delegate
....
MyDelegate d=new MyDelegate(MyFunc); //MyFunc is declared elsewhere as
"private void MyFunc(DataSet ds)"
What I want to do is:
internal delegate void MyDelegate(DataSet ds); //delcare my delegate
...
string str="MyFunc";
object obj=GET_METHOD_REFERENCE(str); //this is what I don't know how
to do
MyDelegate d=new MyDelegate(obj);
It seems that refelection should be able to handle that but I can't find
anything.
TIA
</joel>
method name. I don't want a MethodInfo object; I want an actual reference to
the method. Basically I'm trying to programatically load a delegate via the
method name that should be invoked. For example the "normal" way of doing it
is:
internal delegate void MyDelegate(DataSet ds); //delcare my delegate
....
MyDelegate d=new MyDelegate(MyFunc); //MyFunc is declared elsewhere as
"private void MyFunc(DataSet ds)"
What I want to do is:
internal delegate void MyDelegate(DataSet ds); //delcare my delegate
...
string str="MyFunc";
object obj=GET_METHOD_REFERENCE(str); //this is what I don't know how
to do
MyDelegate d=new MyDelegate(obj);
It seems that refelection should be able to handle that but I can't find
anything.
TIA
</joel>