Mega Code Archive

 
Categories / C# / Reflection
 

Returns the EventInfo object representing the specified public event

using System; using System.Reflection; using System.Security; class MyEventExample {     public static void Main()     {               Type myType = typeof(System.Windows.Forms.Button);             EventInfo myEvent = myType.GetEvent("Click");             if(myEvent != null)             {                 Console.WriteLine("Looking for the Click event in the Button class.");                 Console.WriteLine(myEvent.ToString());             }     } }