mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-07-02 08:38:13 +00:00
fix: Fixed a bug where EnumUtils.GetFlags, and overloads, would also return defined composites
This commit is contained in:
parent
7ae9e86e1d
commit
5f2c5e6dcb
1 changed files with 5 additions and 4 deletions
|
|
@ -352,10 +352,11 @@ 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(value, () => GetValues(type)
|
.GetOrAddNew(type, () => new Dictionary<object, object[]>())
|
||||||
.Where(f => HasFlag(value, f))
|
.GetOrAddNew(value, () => GetValues(type)
|
||||||
.ToArray()));
|
.Where(f => !HasMultipleFlags((int)f) && HasFlag(value, f))
|
||||||
|
.ToArray()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue