Exemple #1
0
        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));
        }
Exemple #2
0
        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());
        }