Assembly attributes

Description :


We can display a list of all the Assembly attributes contained in an assembly file.

Following namespace is used

using System.Reflection;


Following is the code segment

Assembly assembly =
Assembly.LoadFrom (@"C:\MyFolder\MyClassLibrary.dll");
object[] Myattibutes = assembly.GetCustomAttributes (true);
if (attibutes .Length > 0)
{
Console.WriteLine ("Assembly attributes for '{0}'", assembly );
foreach (object Myobject in Myattibutes) {
Console.WriteLine ("Attribute: {0}", Myobject.ToString());
}


Code Explanation

1. Change the LoadFrom argument to point to your assembly file
2. Get all the customer attributes
3. Display all the attributes

By
Nathan


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: