mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +00:00
feat: Adding GetFlagsExceptNone parameterless enum util method
This commit is contained in:
@@ -289,6 +289,20 @@ namespace ICD.Common.Utils
|
|||||||
return s_EnumFlagsCache[type][value].Cast<T>();
|
return s_EnumFlagsCache[type][value].Cast<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all of the set flags on the given enum type except 0.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IEnumerable<T> GetFlagsExceptNone<T>()
|
||||||
|
{
|
||||||
|
if (!IsEnumType<T>())
|
||||||
|
throw new ArgumentException(string.Format("{0} is not an enum", typeof(T).Name));
|
||||||
|
|
||||||
|
T allValue = GetFlagsAllValue<T>();
|
||||||
|
return GetFlagsExceptNone(allValue);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all of the set flags on the given enum except 0.
|
/// Gets all of the set flags on the given enum except 0.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user