Table of Contents

Class BitFields

Namespace
Tripous
Assembly
Tripous.dll

Provides helper extension methods for working with enum bit fields.

Supports testing, adding, removing and toggling flag values in enums marked with the FlagsAttribute attribute.

public static class BitFields
Inheritance
BitFields
Inherited Members

Methods

Add<T>(T, T)

Adds the specified flags and returns the resulting value.

public static T Add<T>(this T Value, T Flags) where T : struct, Enum

Parameters

Value T
Flags T

Returns

T

Type Parameters

T

HasAny<T>(T, T)

Returns true when at least one of the specified flags is present.

public static bool HasAny<T>(this T Value, T Flags) where T : struct, Enum

Parameters

Value T
Flags T

Returns

bool

Type Parameters

T

HasNone<T>(T, T)

Returns true when none of the specified flags is present.

public static bool HasNone<T>(this T Value, T Flags) where T : struct, Enum

Parameters

Value T
Flags T

Returns

bool

Type Parameters

T

Has<T>(T, T)

Returns true when the specified flag or flags are present.

public static bool Has<T>(this T Value, T Flag) where T : struct, Enum

Parameters

Value T
Flag T

Returns

bool

Type Parameters

T

In<T>(T, T)

Returns true when the specified value is fully contained in the specified mask.

public static bool In<T>(this T Value, T Mask) where T : struct, Enum

Parameters

Value T
Mask T

Returns

bool

Type Parameters

T

IsExactly<T>(T, T)

Returns true when the value exactly matches the specified flags.

public static bool IsExactly<T>(this T Value, T Flags) where T : struct, Enum

Parameters

Value T
Flags T

Returns

bool

Type Parameters

T

IsZero<T>(T)

Returns true when the value is zero.

public static bool IsZero<T>(this T Value) where T : struct, Enum

Parameters

Value T

Returns

bool

Type Parameters

T

Remove<T>(T, T)

Removes the specified flags and returns the resulting value.

public static T Remove<T>(this T Value, T Flags) where T : struct, Enum

Parameters

Value T
Flags T

Returns

T

Type Parameters

T

Set<T>(T, T, bool)

Adds or removes the specified flags depending on the value of the Enabled argument.

public static T Set<T>(this T Value, T Flags, bool Enabled) where T : struct, Enum

Parameters

Value T
Flags T
Enabled bool

Returns

T

Type Parameters

T

Toggle<T>(T, T)

Toggles the specified flags and returns the resulting value.

public static T Toggle<T>(this T Value, T Flags) where T : struct, Enum

Parameters

Value T
Flags T

Returns

T

Type Parameters

T