public static string GetName(Type enumType, object value) { if (enumType == null || value == null) { throw new ArgumentNullException(); } if (!enumType.IsEnum) { throw new ArgumentException("enumType is not an Enum type."); } EnumInfo info = EnumInfo.GetInfo(enumType); return(info.GetName((int)value)); }
public static string[] GetNames(Type enumType) { if (enumType == null) { throw new ArgumentNullException(); } if (!enumType.IsEnum) { throw new ArgumentException(); } EnumInfo info = EnumInfo.GetInfo(enumType); return(info.GetNames()); }