mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 05:05:05 +00:00
fix: Fixing enum casting exception in SimplSharp
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user