feat: Adding GetFlagsExceptNone parameterless enum util method

This commit is contained in:
Chris Cameron
2018-05-24 10:03:38 -04:00
parent 62abd624f8
commit 35593bfa47

View File

@@ -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>