mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-11 02:35:05 +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>();
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// Gets all of the set flags on the given enum except 0.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user