Show Events

image_pdfimage_print

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); } } } [/csharp][/csharp][/csharp][/csharp][/csharp][/csharp][/csharp]

This entry was posted in Reflection. Bookmark the permalink.