So, I have the following:
public class Singleton
{
private Singleton(){}
public static readonly Singleton instance = new Singleton();
public string DoSomething(){ ... }
public string DoSomethingElse(){ ... }
}
Using reflection, how can I call the DoSomething method?
The reason I'm asking for is because I store the method names in XML and dynamically create a user interface. For example, I dynamically create a button and tell which method to call through reflection when the button is clicked. In some cases it will be DoSomething, or in others it will be DoSomethingElse.
source
share