To get Properties of a Type we will use:
Type classType = typeof(TestClass);
PropertyInfo[] properties = classType.GetProperties(BindingFlags.Public | BindingFlags.Instance);
To get Attributes defined of a Class we will use:
Type classType = typeof(TestClass);
object[] attributes = classType.GetCustomAttributes(false);
Boolean flag passed is the Inheritance flag, whether to search in inheritance chain or not.
To get attributes of a property we will use:
propertyInfo.GetCustomAttributes(false);
Using Harvard Code given above:
Type classType = typeof(TestClass);
object[] classAttributes = classType.GetCustomAttributes(false);
foreach(PropertyInfo property in classType.GetProperties(BindingFlags.Public | BindingFlags.Instance))
{
object[] propertyAttributes = property.GetCustomAttributes(false);
Console.WriteLine(property.Name);
}