Assembly.GetCustomAttributes : Assembly « System.Reflection « C# / C Sharp by API






Assembly.GetCustomAttributes

   

using System;
using System.Reflection;

class Program {
    static void Main(string[] args) {
        string assemblyName = "Your";

        try {
            Assembly a = Assembly.LoadFrom(assemblyName);
            object[] attributes = a.GetCustomAttributes(true);
            if (attributes.Length > 0) {
                Console.WriteLine("Assembly attributes for '{0}'...", assemblyName);

                foreach (object o in attributes)
                    Console.WriteLine("  {0}", o.ToString());
            } else
                Console.WriteLine("Assembly {0} contains no Attributes.", assemblyName);
        } catch (Exception ex) {
            Console.WriteLine(ex.ToString());
        }
    }
}

   
    
    
  








Related examples in the same category

1.Assembly.CodeBase
2.Assembly.EntryPoint
3.Assembly.EscapedCodeBase
4.Assembly.Evidence
5.Assembly.FullName
6.Assembly.GetCallingAssembly()
7.Assembly.GetEntryAssembly()
8.Assembly.GetExecutingAssembly()
9.Assembly.GetExportedTypes
10.Assembly.GetName
11.Assembly.GetReferencedAssemblies
12.Assembly.GetTypes()
13.Assembly.GlobalAssemblyCache
14.Assembly.Load(AssemblyName name2)
15.Assembly.Load(String name)
16.Assembly.LoadFrom(String assemblyName)
17.Assembly.Location