Show / Hide Table of Contents

Class EnumFlagExtensions

Useful extension methods for Enum flags.

Inheritance
Object
EnumFlagExtensions
Inherited Members
System.Object.ToString()
Object.Equals(Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
Object.MemberwiseClone()
Namespace: IRM
Assembly: IRM.dll
Syntax
public static class EnumFlagExtensions

Methods

AddFlag<T>(Enum, T)

Adds a flag to an enum.

Declaration
public static T AddFlag<T>(this Enum type, T value)
Parameters
Enum type

The enum to add a flag to.

T value

The flag value to add.

Returns
T

The enum with the flag added to.

Type Parameters
T

The type of enumeration.

IsFlag<T>(Enum, T)

Determines if an enum is equal to a value.

Declaration
public static bool IsFlag<T>(this Enum type, T value)
Parameters
Enum type

The enumeration to compare.

T value

The value that the enum shall be equal to.

Returns
Boolean

true if the type is equal to value; otherwise false.

Type Parameters
T

The type of enum.

RemoveFlag<T>(Enum, T)

Removes a flag from an enum.

Declaration
public static T RemoveFlag<T>(this Enum type, T value)
Parameters
Enum type

The enum to remove a flag from.

T value

The flag value to remove.

Returns
T

The enum with the flag removed from.

Type Parameters
T

The type of enumeration.

Back to top Generated by DocFX