Tag Archives: MethodInfo

Use reflection to list a class’s methods in C#

This example uses the following code to add some simple methods to the Form1 class. // Add some methods. private void MyPrivateMethod(string arg0, string arg2) { } public void MyPublicMethod(float float0, double double0) { } private void MyOverloadedMethod() { } … Continue reading

Posted in reflection | Tagged , , , , , , , , , | Leave a comment

Invoke public methods by using their names in C#

You can use reflection to invoke public methods by using their names. The following code shows how the example program does this. // Invoke the method. private void btnInvoke_Click(object sender, EventArgs e) { try { Type this_type = this.GetType(); MethodInfo … Continue reading

Posted in classes, reflection | Tagged , , , , , , , , , | Leave a comment