How to map an int to its enum description using AutoMapper during a queryable projection?
问题 Here is the enum extension method to get its description attribute. public static string GetDescription(this Enum enumeration) { if (enumeration == null) throw new ArgumentNullException(); var value = enumeration.ToString(); var type = enumeration.GetType(); var descriptionAttribute = (DescriptionAttribute[]) type.GetField(value).GetCustomAttributes(typeof (DescriptionAttribute), false); return descriptionAttribute.Length > 0 ? descriptionAttribute[0].Description : value; } Here is the source