O
ogled
Hi
I have an odd question: is it possible to have a delegate that recieves
a methodname dynamically?
Like this: aClassObj.OnGo += new ANamespace.Invoke(fName);
where fName would be a string with the function name;
Maybe this is totally conceptually wrong, but right now I'm nont sure
which way to go.
I have a timer that trigger an event OnGo that fires a function within
a class and now I'd like to have a number of functions that can be
called and is decided in an xml document. Possibly a stupid idea, but i
don't know how to proceed.
TopObj->holds instance of callerObj
callerObj-> creates a instance of delegateObj
callerObj -> assigns one of its own functions to the event
delegateObj.OnGo
If it doesn't make any sense tell me to bury it and rewrite...:-(
Example on what I would like to do:
namespace ANamespace{
public delegate void Invoke(string ObjId);
Class A{
public event Invoke OnGo;
.....
}
Class B {
A aClassObj;
...
public B()
{
aClassObj = new A();
}
public void functionAssign(string fName)
{
aClassObj.OnGo += new ANamespace.Invoke(fName);
}
public void callerFunction(string ID){...}
}
}
I have an odd question: is it possible to have a delegate that recieves
a methodname dynamically?
Like this: aClassObj.OnGo += new ANamespace.Invoke(fName);
where fName would be a string with the function name;
Maybe this is totally conceptually wrong, but right now I'm nont sure
which way to go.
I have a timer that trigger an event OnGo that fires a function within
a class and now I'd like to have a number of functions that can be
called and is decided in an xml document. Possibly a stupid idea, but i
don't know how to proceed.
TopObj->holds instance of callerObj
callerObj-> creates a instance of delegateObj
callerObj -> assigns one of its own functions to the event
delegateObj.OnGo
If it doesn't make any sense tell me to bury it and rewrite...:-(
Example on what I would like to do:
namespace ANamespace{
public delegate void Invoke(string ObjId);
Class A{
public event Invoke OnGo;
.....
}
Class B {
A aClassObj;
...
public B()
{
aClassObj = new A();
}
public void functionAssign(string fName)
{
aClassObj.OnGo += new ANamespace.Invoke(fName);
}
public void callerFunction(string ID){...}
}
}