mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +00:00
fix: Fixed a bug where EnumUtils.GetFlags, and overloads, would also return defined composites
This commit is contained in:
@@ -352,9 +352,10 @@ namespace ICD.Common.Utils
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IEnumerable<object> GetFlags(Type type, object value)
|
public static IEnumerable<object> GetFlags(Type type, object value)
|
||||||
{
|
{
|
||||||
return s_EnumFlagsCacheSection.Execute(() => s_EnumFlagsCache.GetOrAddNew(type, () => new Dictionary<object, object[]>())
|
return s_EnumFlagsCacheSection.Execute(() => s_EnumFlagsCache
|
||||||
|
.GetOrAddNew(type, () => new Dictionary<object, object[]>())
|
||||||
.GetOrAddNew(value, () => GetValues(type)
|
.GetOrAddNew(value, () => GetValues(type)
|
||||||
.Where(f => HasFlag(value, f))
|
.Where(f => !HasMultipleFlags((int)f) && HasFlag(value, f))
|
||||||
.ToArray()));
|
.ToArray()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user