mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
feat: Added enum extensions for finding the inclusion and exclusion of enum flags
This commit is contained in:
parent
b68c5f1c97
commit
79a98d8c10
2 changed files with 29 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Added MathUtils methods for converting to and from percentages
|
- 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
|
## [10.2.0] - 2019-12-04
|
||||||
### Added
|
### Added
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,34 @@ namespace ICD.Common.Utils.Extensions
|
||||||
return EnumUtils.HasFlags(extends, values);
|
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>
|
/// <summary>
|
||||||
/// Returns the enum value as a
|
/// Returns the enum value as a
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue