16 lines
456 B
C#
16 lines
456 B
C#
using System.Reflection;
|
|
|
|
namespace Brizco.Common.Extensions
|
|
{
|
|
public static class PropertyExtensions
|
|
{
|
|
public static string GetPropertyDisplayName(this MemberInfo propertyExpression)
|
|
{
|
|
var memberInfo = propertyExpression;
|
|
var attr = memberInfo.GetCustomAttributes<DisplayAttribute>().FirstOrDefault();
|
|
if (attr == null) return memberInfo.Name;
|
|
|
|
return attr.Name;
|
|
}
|
|
}
|
|
} |