Social Icons

Pages

Saturday, January 14, 2012

Retrieving Assembly Attributes

To retrieve the value set in the Assembly Attributes in the AssemblyInfo.cs file, use the code below. The example shows retrieving the AssemblyName attribute.
void displayAssemblyName()
     {
 System.Reflection.Assembly thisAssembly = this.GetType().Assembly;
 object[] attributes = thisAssembly.GetCustomAttributes  (typeof(AssemblyNametAttribute), false);
           {
this.labelName.Text = ((AssemblyNametAttribute)attributes[0]).Name;
            }
       }


No comments:

Post a Comment