feat: Added enum extensions for finding the inclusion and exclusion of enum flags

This commit is contained in:
Chris Cameron
2019-12-05 15:31:20 -05:00
parent b68c5f1c97
commit 79a98d8c10
2 changed files with 29 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Added MathUtils methods for converting to and from percentages
- Added enum extensions for finding the inclusion and exclusion of enum flags
## [10.2.0] - 2019-12-04
### Added

View File

@@ -31,6 +31,34 @@ namespace ICD.Common.Utils.Extensions
return EnumUtils.HasFlags(extends, values);
}
/// <summary>
/// Returns these enum flags, excluding the other enum flags.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="extends"></param>
/// <param name="other"></param>
/// <returns></returns>
[PublicAPI]
public static T ExcludeFlags<T>(this T extends, T other)
where T : struct, IConvertible
{
return EnumUtils.ExcludeFlags(extends, other);
}
/// <summary>
/// Returns these enum flags, including the other enum flags.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="extends"></param>
/// <param name="other"></param>
/// <returns></returns>
[PublicAPI]
public static T IncludeFlags<T>(this T extends, T other)
where T : struct, IConvertible
{
return EnumUtils.IncludeFlags(extends, other);
}
/// <summary>
/// Returns the enum value as a
/// </summary>