HOWTO list all my functions in CSharp (C#) using Reflection

It's easy to list all methods (functions) directly in C#, below you will find code sample. And working example you can take here.

If you are looking for static methods, you should replace BindingFlags.Instance with BindingFlags.Static
class Program

{

private int PrivateMethod() { return 0; }

protected bool ProtectedMethod() {return true; }

public void IAmFunction(object param1, Array param2) { }

static void Main(string[] args)

{

Type myType = typeof(Program);

// Get the public methods.

MethodInfo[] myMethods = myType.GetMethods(BindingFlags.Instance |

BindingFlags.DeclaredOnly|

BindingFlags.Public |

BindingFlags.NonPublic );



Console.WriteLine("i have found {0} methods of Type {1}: \n", myMethods.Length, myType.FullName);

// Display all the methods.

foreach (MethodInfo m in myMethods) {

Console.WriteLine("Name: {0}", m.Name);

Console.WriteLine("Return Type: {0}", m.ReturnType.ToString());

ParameterInfo[] parameters = m.GetParameters();

Console.WriteLine("I have {0} input parameter(s):", parameters.Length);

foreach (ParameterInfo pi in parameters) {

Console.WriteLine(" Name: {0}", pi.Name);

Console.WriteLine(" Type: {0}", pi.ParameterType.ToString());

Console.WriteLine("");

}

Console.WriteLine("------------------------------------------\n");

}

Console.WriteLine("==========================================\n");

}

}

HOWTO: Repair Logitech M325 Mouse

FixIt says that you will find single screw under CE label. It isn't always true.