blob: ab3201cf334e0193e4151a3e265c51d4c9e107b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
public static class EnumExtensions
{
///// <summary>
///// Gets the Enum value description.
///// </summary>
///// <param name="value">The value.</param>
///// <returns></returns>
//public static String ToDescription(this Enum value)
//{
// FieldInfo fi = value.GetType().GetField(value.ToString());
// DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
// if (attributes != null &&
// attributes.Length > 0)
// return attributes[0].Description;
// else
// return value.ToString();
//}
}
|