19.1.3-ctp

This commit is contained in:
Alexander Mikhailov
2019-05-16 10:20:43 +03:00
committed by GitHub
parent 2e45b5d38f
commit a2371dfb0b
187 changed files with 32565 additions and 3985 deletions

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace DevExpress.DevAV.Reports {
static class EnumDisplayTextHelper {
public static string GetDisplayText(object value) {
MemberInfo[] info = value.GetType().GetMember(value.ToString());
object[] attributes = info[0].GetCustomAttributes(false);
for(int i = 0; i < attributes.Length; i++) {
Type attributeType = attributes[i].GetType();
if(attributeType == typeof(System.ComponentModel.DataAnnotations.DisplayAttribute))
return (string)attributeType.GetProperty("Name").GetValue(attributes[i], null) ?? string.Empty;
}
return value.ToString();
}
}
}