Returns all the public events that are declared or inherited by the current Type.
using System;
using System.Reflection;
using System.Security;
class EventsSample
{
publicstaticvoid Main()
{
BindingFlags myBindingFlags = BindingFlags.Instance | BindingFlags.Public;
Type myTypeEvent = typeof(System.Windows.Forms.Button);
EventInfo[] myEventsBindingFlags = myTypeEvent.GetEvents(myBindingFlags);
Console.WriteLine("\nThe events on the Button class with the specified BindingFlags are : ");
for (int index = 0; index < myEventsBindingFlags.Length; index++)
{
Console.WriteLine(myEventsBindingFlags[index].ToString());
}
}
}