public static string ToDescriptionString(this ExportedType val) { DescriptionAttribute[] attributes = (DescriptionAttribute[])val .GetType() .GetField(val.ToString()) .GetCustomAttributes(typeof(DescriptionAttribute), false); return(attributes.Length > 0 ? attributes[0].Description : string.Empty); }
public void Snippet6() { Console.WriteLine("SNIPPET6:"); // <Snippet6> Assembly SampleAssembly; // Load the assembly by providing the location of the assembly file. SampleAssembly = Assembly.LoadFrom("c:\\Sample.Assembly.dll"); foreach (Type ExportedType in SampleAssembly.GetExportedTypes()) { Console.WriteLine(ExportedType.ToString()); } // </Snippet6> Console.WriteLine(); }