diff --git a/ICD.Common.Utils/EnumUtils.cs b/ICD.Common.Utils/EnumUtils.cs index 528cd03..38241fe 100644 --- a/ICD.Common.Utils/EnumUtils.cs +++ b/ICD.Common.Utils/EnumUtils.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using ICD.Common.Properties; -using ICD.Common.Utils.Collections; using ICD.Common.Utils.Extensions; #if SIMPLSHARP using System.Globalization; @@ -15,8 +14,15 @@ namespace ICD.Common.Utils { public static class EnumUtils { - private static readonly Dictionary> s_EnumValuesCache = - new Dictionary>(); + private static readonly Dictionary s_EnumValuesCache; + + /// + /// Static constructor. + /// + static EnumUtils() + { + s_EnumValuesCache = new Dictionary(); + } /// /// Returns true if the given type is an enum. @@ -119,7 +125,7 @@ namespace ICD.Common.Utils // Reflection is slow and this method is called a lot, so we cache the results. if (!s_EnumValuesCache.ContainsKey(type)) - s_EnumValuesCache[type] = GetValuesUncached(type).ToIcdHashSet(); + s_EnumValuesCache[type] = GetValuesUncached(type).ToArray(); return s_EnumValuesCache[type]; } diff --git a/ICD.Common.Utils/Extensions/EnumExtensions.cs b/ICD.Common.Utils/Extensions/EnumExtensions.cs index f6de53f..aa44ed3 100644 --- a/ICD.Common.Utils/Extensions/EnumExtensions.cs +++ b/ICD.Common.Utils/Extensions/EnumExtensions.cs @@ -49,8 +49,8 @@ namespace ICD.Common.Utils.Extensions throw new ArgumentException(message); } - ulong num = Convert.ToUInt64(value); - return (Convert.ToUInt64(extends) & num) == num; + int num = (int)(object)value; + return ((int)(object)extends & num) == num; } } }