Table of Contents

Class FlagsEnum

Namespace
Arc4u
Assembly
Arc4u.dll

Provides extension methods for flags enumerations.

public static class FlagsEnum
Inheritance
FlagsEnum
Inherited Members

Methods

ContinuousFlagValues<TEnum>(TEnum)

Indicates if the flag values of the specified value are continuous or not.

public static bool ContinuousFlagValues<TEnum>(TEnum value) where TEnum : struct

Parameters

value TEnum

A combined value of TEnum.

Returns

bool

true if the flag values of the specified value are continuous; otherwise, false.

Type Parameters

TEnum

An enumeration type.

Exceptions

ArgumentException

TEnum is not an enumeration type.

FlagValues<TEnum>()

Gets the flag values defined in TEnum.

public static IEnumerable<TEnum> FlagValues<TEnum>() where TEnum : struct

Returns

IEnumerable<TEnum>

The defined flag values.

Type Parameters

TEnum

An enumeration type.

Exceptions

ArgumentException

TEnum is not an enumeration type.

FlagValues<TEnum>(TEnum)

Gets the flag values of the specified value.

public static IEnumerable<TEnum> FlagValues<TEnum>(TEnum value) where TEnum : struct

Parameters

value TEnum

A combined value of TEnum.

Returns

IEnumerable<TEnum>

The flag values of the specified value.

Type Parameters

TEnum

An enumeration type.

Exceptions

ArgumentException

TEnum is not an enumeration type.

FlaggedValues<TEnum>()

Gets the flagged values defined in TEnum.

public static IEnumerable<TEnum> FlaggedValues<TEnum>() where TEnum : struct

Returns

IEnumerable<TEnum>

The defined flagged values.

Type Parameters

TEnum

An enumeration type.

Exceptions

ArgumentException

TEnum is not an enumeration type.

PowerOfTwoExponent(object)

Gets the power of two exponent from the specified value.

public static int PowerOfTwoExponent(object value)

Parameters

value object

A value.

Returns

int

The power of two exponent from the specified value.

Exceptions

ArgumentException

value is not a power of two exponent.

PowerOfTwo<TEnum>(object)

Gets a value of TEnum from two raised to the specified power.

public static TEnum PowerOfTwo<TEnum>(object power) where TEnum : struct

Parameters

power object

The raising power of two.

Returns

TEnum

The matching value of TEnum.

Type Parameters

TEnum

An enumeration type.

Exceptions

ArgumentException

TEnum is not an enumeration type -or- no match found in the defined values of TEnum.

TryPowerOfTwoExponent(object?, out int, float)

Tries to get the power of two exponent from the specified value.

public static bool TryPowerOfTwoExponent(object? value, out int result, float epsilon = 1E-07)

Parameters

value object

A value.

result int

When this methods returns, contains the power of two exponent from the specified value. This parameter is passed uninitialized.

epsilon float

The tolerance used when checking that the exponent is an integer.

Returns

bool

true if the value parameter is a power of two exponent; otherwise, false.

TryPowerOfTwo<TEnum>(object, out TEnum, float)

Tries to get a value of TEnum from two raised to the specified power.

public static bool TryPowerOfTwo<TEnum>(object power, out TEnum result, float epsilon = 1E-07) where TEnum : struct

Parameters

power object

The raising power of two.

result TEnum

When this methods returns, contains the matching value of TEnum. This parameter is passed uninitialized.

epsilon float

The tolerance used when checking that the computed value is an integer.

Returns

bool

true if a matching value of TEnum is found; otherwise, false.

Type Parameters

TEnum

An enumeration type.