Class EnumExtensions
Contains extension methods for System.Enums.
public static class EnumExtensions
- Inheritance
-
objectEnumExtensions
Methods
GetEnumAttribute<TAttribute>(Enum)
Gets the first TAttribute
attribute set on the target
enum value.
[Pure]
public static TAttribute? GetEnumAttribute<TAttribute>(this Enum target) where TAttribute : Attribute
Parameters
target
Enum
Returns
- TAttribute
Type Parameters
TAttribute
HasFlag(Enum, Enum)
Checks whether a flag is set.
[Pure]
public static bool HasFlag(this Enum enumRef, Enum flag)
Parameters
enumRef
Enumflag
Enum
Returns
- bool
HasFlag(int, int)
Checks whether a flag is set.
[Pure]
public static bool HasFlag(this int enumRef, int flag)
Parameters
enumRef
intflag
int
Returns
- bool
HasFlag(ushort, ushort)
Checks whether a flag is set.
[CLSCompliant(false)]
[Pure]
public static bool HasFlag(this ushort enumRef, ushort flag)
Parameters
enumRef
ushortflag
ushort
Returns
- bool