Display Assembly attributes

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
C# Code Snippets

C# Source Code Bank

See also …
edit

This C# code snippet displays a list of all the Assembly attributes contained in an assembly file.

using System.Reflection;
 
// Change the LoadFrom argument to point to your assembly file
Assembly assembly  = 
   Assembly.LoadFrom (@"C:\Documents\ClassLibrary.dll");
object[] attibutes = assembly.GetCustomAttributes (true);
if (attibutes .Length > 0)
   {
   Console.WriteLine ("Assembly attributes for '{0}'", assembly );
   foreach (object o in attibutes) {
      Console.WriteLine ("Attribute: {0}", o.ToString());
   }

Today's Deals: Electronics

Personal tools