Display information about each module of this assembly : AssemblyName « Reflection « C# / C Sharp






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

1.AssemblyName Class describes an assembly's unique identity in full.
2.Initializes a new instance of the AssemblyName class with the specified display name.
3.Gets or sets the major, minor, build, and revision numbers of the assembly.