Exemple #1
0
        public static bool TryToString(Type enumType, object value, NamingStrategy namingStrategy, out string name)
        {
            EnumInfo enumInfo = EnumUtils.ValuesAndNamesPerEnum.Get(new StructMultiKey <Type, NamingStrategy>(enumType, namingStrategy));
            ulong    num      = EnumUtils.ToUInt64(value);

            if (enumInfo.IsFlags)
            {
                name = EnumUtils.InternalFlagsFormat(enumInfo, num);
                return(name != null);
            }
            int num1 = Array.BinarySearch <ulong>(enumInfo.Values, num);

            if (num1 < 0)
            {
                name = null;
                return(false);
            }
            name = enumInfo.ResolvedNames[num1];
            return(true);
        }