Type.GetEvents() : Type « System « C# / C Sharp by API






Type.GetEvents()

  


using System;
using System.Reflection;

class MainClass {

    public static void ShowEvents(Type t) {
        EventInfo[] events = t.GetEvents();
        Console.WriteLine("Implemented Events");
        foreach (EventInfo e in events) {
            Console.WriteLine("Event name: {0}", e.Name);
            Console.WriteLine("Multicast: {0}", e.IsMulticast ? "Yes" : "No");
            Console.WriteLine("Member Type {0}", e.MemberType.ToString());
        }
    }

    public static void ShowTypes(string name, Assembly assembly) {
        Type[] typeArray = assembly.GetTypes();

        Console.WriteLine("Assembly Name: {0}", name);
        foreach (Type type in typeArray) {
            if (type.IsClass) {

                ShowEvents(type);
            } 
        }
    }
    public static void Main(string[] args) {
        for (int i = 0; i < args.Length; ++i) {
            // Get the assemble object (from System.Reflection)
            Assembly assembly = Assembly.LoadFrom(args[0]);

            ShowTypes(args[0], assembly);
        }
    }
}

   
    
  








Related examples in the same category

1.Type.BaseType
2.Type.ContainsGenericParameters
3.Type.FullName
4.Type.GetConstructor
5.Type.GetCustomAttributes
6.Type.GetFields()
7.Type.GetGenericArguments()
8.Type.GetGenericTypeDefinition()
9.Type.GetInterfaces()
10.Type.GetMethod(String methodName);
11.Type.GetMethods()
12.Type.GetProperties()
13.Type.GetType(String typeName)
14.Type.GetType(String typeName, true)
15.Type.GetType(String typeName, true, true);
16.Type.IsAbstract
17.Type.IsClass
18.Type.IsCOMObject
19.Type.IsEnum
20.Type.IsGenericTypeDefinition
21.Type.IsSealed
22.Type.MakeGenericType
23.Type.Name
24.Type.ReflectionOnlyGetType
25.Type.UnderlyingSystemType