foreach (var property in typeof(MyClassFromEntity).GetProperties())
{
foreach (var attribute in property.GetCustomAttributes(true))
{
if(attribute is DisplayNameAttribute)
{
var displayNameAttribute = attribute as DisplayNameAttribute;
var displayName = displayNameAttribute.Name;
}
else if(attribute is GroupNameAttribute)
{
var groupNameAttribute = attribute as GroupNameAttribute;
var groupName = groupNameAttribute.Name;
}
}
}