Mega Code Archive

 
Categories / C# Tutorial / WPF
 

Dump Content Property Attributes

using System; using System.Collections.Generic; using System.Reflection; using System.Windows; using System.Windows.Markup; public class MainClass {     [STAThread]     public static void Main()     {         UIElement dummy1 = new UIElement();         FrameworkElement dummy2 = new FrameworkElement();         SortedList<string, string> listClass = new SortedList<string, string>();         foreach (AssemblyName asmblyname in Assembly.GetExecutingAssembly().GetReferencedAssemblies())         {             foreach (Type type in Assembly.Load(asmblyname).GetTypes())             {                 foreach (object obj in type.GetCustomAttributes(typeof(ContentPropertyAttribute), true))                 {                     if (type.IsPublic && obj as ContentPropertyAttribute != null){                         Console.WriteLine(type.Name);                         Console.WriteLine((obj as ContentPropertyAttribute).Name);                     }                     }             }         }     } }