Esempio n. 1
0
 public EnumBitMask32(TEnum enumValue)
 {
     if (EnumConv.ToInt32(enumValue) != 0)
     {
         m_mask = EnumToBit(enumValue);
     }
     else
     {
         m_mask = 0;
     }
 }
Esempio n. 2
0
        public EnumBitMask(TEnum enumValue)
        {
            BitArray mask = null;

            if (EnumConv.ToInt32(enumValue) != 0)
            {
                mask = new BitArray(s_numBits);
                mask.Set(EnumConv.ToInt32(enumValue) - 1, true);
            }

            m_mask = mask;
        }
Esempio n. 3
0
        public EnumBitMask(IEnumerable <TEnum> enumValues)
        {
            BitArray mask = null;

            if (enumValues.Any())
            {
                mask = new BitArray(s_numBits);
                foreach (TEnum e in enumValues)
                {
                    mask.Set(EnumConv.ToInt32(e) - 1, true);
                }
            }

            m_mask = mask;
        }
Esempio n. 4
0
 uint EnumToBit(TEnum e)
 {
     return(1U << (EnumConv.ToInt32(e) - 1));
 }
Esempio n. 5
0
 ulong EnumToBit(TEnum e)
 {
     return(1UL << (EnumConv.ToInt32(e) - 1));
 }
Esempio n. 6
0
 /// <summary>
 /// Of
 /// </summary>
 /// <param name="member"></param>
 /// <param name="enumType"></param>
 /// <param name="defaultVal"></param>
 /// <returns></returns>
 public static object Of(object member, Type enumType, object defaultVal = default)
 {
     return(EnumConv.ToEnum(member, enumType, defaultVal));
 }
Esempio n. 7
0
 /// <summary>
 /// Of
 /// </summary>
 /// <param name="member"></param>
 /// <param name="enumType"></param>
 /// <param name="ignoreCase"></param>
 /// <param name="defaultVal"></param>
 /// <returns></returns>
 public static object Of(string member, Type enumType, bool ignoreCase = false, object defaultVal = default)
 {
     return(EnumConv.ToEnum(member, enumType, ignoreCase, defaultVal));
 }
Esempio n. 8
0
 /// <summary>
 /// Of
 /// </summary>
 /// <param name="member"></param>
 /// <param name="defaultVal"></param>
 /// <typeparam name="TEnum"></typeparam>
 /// <returns></returns>
 public static TEnum Of <TEnum>(object member, TEnum defaultVal = default) where TEnum : struct, Enum
 {
     return(EnumConv.ToEnum(member, defaultVal));
 }
Esempio n. 9
0
 /// <summary>
 /// Of
 /// </summary>
 /// <param name="member"></param>
 /// <param name="ignoreCase"></param>
 /// <param name="defaultVal"></param>
 /// <typeparam name="TEnum"></typeparam>
 /// <returns></returns>
 public static TEnum Of <TEnum>(string member, bool ignoreCase = false, TEnum defaultVal = default) where TEnum : struct, Enum
 {
     return(EnumConv.ToEnum(member, ignoreCase, defaultVal));
 }
Esempio n. 10
0
 public static int GetEnumMax <TEnum>()
 {
     return(EnumConv.ToInt32(GetEnumValues <TEnum>().Max()));
 }
Esempio n. 11
0
 public bool Get(TEnum enumValue)
 {
     return(m_mask != null && m_mask.Get(EnumConv.ToInt32(enumValue) - 1));
 }