Mega Code Archive

 
Categories / C# / Reflection
 

Gets the parameters of the specified method or constructor

using System; using System.Reflection; public delegate void MyDelegate(int i); public class MainClass  {     public event MyDelegate ev;     public static void Main()      {         Type delegateType = typeof(MainClass).GetEvent("ev").EventHandlerType;         MethodInfo invoke = delegateType.GetMethod("Invoke");         ParameterInfo[] pars = invoke.GetParameters();         foreach (ParameterInfo p in pars)          {             Console.WriteLine(p.ParameterType);         }     } }