mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
fix: Fixing enum casting exception in SimplSharp
This commit is contained in:
parent
6a979f5c12
commit
918e6f5b34
1 changed files with 2 additions and 1 deletions
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue