i totaly got stuck in a Reflection Problem, i think it isn't real big, but i don't find any solution for this.
public class myClass : myClassIF {
public myClass() { }
private void doSomething_A() {
//...
}
private void doSomething_B() {
//...
}
public void DecideAndCall(string identifier) {
string methodName = "doSomething_" + identifier;
MethodInfo mi = this.GetType().GetMethod(methodName); //here i got a NullReference??
//here should be the Invocation of the Method and so on...
}
}
The Interface looks this way:
public interface myClassIF {
void DecideAndCall(string identifier);
}
If i call the GetMethod("...")-Method, i always got a NullReference. I can't understand this, because in an other Part of this Project i've done this before. But there i used Refelction to an other Type not to "this".
Is it possible to Reflect Methods in the actually instanciated Object? I think i'd should be, but i don't know how...
Many Thanks! Benni