public class AttributeHelper
{
public static string GetDisplayName(Type modelType, string propertyDisplayName)
{
return (TypeDescriptor.GetProperties(modelType)[propertyDisplayName].Attributes[typeof(DisplayNameAttribute)] as DisplayNameAttribute).DisplayName;
}
public static string GetDisplay(Type modelType, string propertyDisplayName)
{
return (TypeDescriptor.GetProperties(modelType)[propertyDisplayName].Attributes[typeof(DisplayAttribute)] as DisplayAttribute).Name;
}
}