mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +00:00
feat: Added enum extensions for finding the inclusion and exclusion of enum flags
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user