Display information about each module of this assembly
using System;
using System.Reflection;
class Module1
{
public static void DisplayAttributes(MemberInfo mi)
{
object[] attrs = mi.GetCustomAttributes(false);
if (attrs.Length == 0) { return; }
Console.WriteLine("Attributes:");
foreach (object o in attrs)
{
Console.WriteLine(o.ToString());
}
}
public static void Main()
{
Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
foreach (Assembly b in AppDomain.CurrentDomain.GetAssemblies())
{
Console.WriteLine("Assembly: {0}", b);
foreach (Module m in b.GetModules(true))
{
Console.WriteLine("Module: {0}", m.Name);
}
}
}
}
Related examples in the same category