Class EnumExtensions
- Namespace
- FluentCommand.Extensions
- Assembly
- FluentCommand.dll
A class to help with Enum Flags.
public static class EnumExtensions
- Inheritance
-
EnumExtensions
- Inherited Members
Methods
IsAnyFlagOn<T>(Enum, T)
Determines whether any flag is on for the specified mask.
public static bool IsAnyFlagOn<T>(this Enum mask, T flag) where T : struct, IComparable, IFormattable, IConvertible
Parameters
mask
EnumThe mask to check if the flag is on.
flag
TThe flag to check for in the mask.
Returns
- bool
true
if any flag is on for the specified mask; otherwise,false
.
Type Parameters
T
The flag type.
IsFlagOn<T>(Enum, T)
Determines whether the flag is on for the specified mask.
public static bool IsFlagOn<T>(this Enum mask, T flag) where T : struct, IComparable, IFormattable, IConvertible
Parameters
mask
EnumThe mask to check if the flag is on.
flag
TThe flag to check for in the mask.
Returns
- bool
true
if the flag is on for the specified mask; otherwise,false
.
Type Parameters
T
The flag type.
SetFlagOff<T>(Enum, T)
Sets the flag off in the specified mask.
public static T SetFlagOff<T>(this Enum mask, T flag) where T : struct, IComparable, IFormattable, IConvertible
Parameters
mask
EnumThe mask to set flag off.
flag
TThe flag to set.
Returns
- T
The mask with the flag set to off.
Type Parameters
T
The flag type.
SetFlagOn<T>(Enum, T)
Sets the flag on in the specified mask.
public static T SetFlagOn<T>(this Enum mask, T flag) where T : struct, IComparable, IFormattable, IConvertible
Parameters
mask
EnumThe mask to set flag on.
flag
TThe flag to set.
Returns
- T
The mask with the flag set to on.
Type Parameters
T
The flag type.
ToggleFlag<T>(Enum, T)
Toggles the flag in the specified mask.
public static T ToggleFlag<T>(this Enum mask, T flag) where T : struct, IComparable, IFormattable, IConvertible
Parameters
mask
EnumThe mask to toggle the flag against.
flag
TThe flag to toggle.
Returns
- T
The mask with the flag set in the opposite position then it was.
Type Parameters
T
The flag type.