Wednesday, September 28, 2011

How to get property name in Class object


TheType.MyClass aClass = new TheType.MyClass();

    Type t = aClass.GetType();
    PropertyInfo[] pi = t.GetProperties();
    foreach(PropertyInfo prop in pi)
      Console.WriteLine("Prop: {0}",  prop.Name);

No comments:

Post a Comment