public static void InvokeSpecificMethod() { var p = new Person2 { Name = "Frank Olivarez" }; var type = p.GetType(); var result = type.GetMethod("Speak").Invoke(p, null); Console.WriteLine(result); }
public static void GetMethods() { var p = new Person2 { Name = "Jesse Olivarez" }; //Console.WriteLine(p.Speak()); var type = p.GetType(); var methods = type.GetMethods(); foreach (var method in methods) { Console.WriteLine(method.Name); } }