fix: Fixing enum casting exception in SimplSharp

This commit is contained in:
Chris Cameron
2018-07-26 13:43:34 -04:00
parent 6a979f5c12
commit 918e6f5b34

View File

@@ -58,6 +58,7 @@ namespace ICD.Common.Utils
/// <returns></returns> /// <returns></returns>
public static bool IsEnum<T>(T value) public static bool IsEnum<T>(T value)
{ {
// ReSharper disable once CompareNonConstrainedGenericWithNull
return value != null && IsEnumType(value.GetType()); return value != null && IsEnumType(value.GetType());
} }
@@ -165,7 +166,7 @@ namespace ICD.Common.Utils
private static IEnumerable<T> GetValuesUncached<T>() private static IEnumerable<T> GetValuesUncached<T>()
where T : struct, IConvertible where T : struct, IConvertible
{ {
return GetValuesUncached(typeof(T)).Cast<T>(); return GetValuesUncached(typeof(T)).Select(i => (T)(object)i);
} }
/// <summary> /// <summary>