Skip to content

HasAllFlag Method ​

Definition ​

  • Namespace: JASE.Extensions
  • Assembly: JASE.Primitives.dll

Overloads ​

NameDescription
bool HasAllFlag(bool allowMaxEqualAll = null)Determines whether the specified enum type includes a value that represents all defined flags.
bool HasAllFlag(out long allFlagValue, bool allowMaxEqualAll = null)Determines whether the specified enum type includes a value that represents all defined flags, and returns the value if found.

bool HasAllFlag(bool allowMaxEqualAll = null) ​

csharp
bool HasAllFlag(bool allowMaxEqualAll = null)

Determines whether the specified enum type includes a value that represents all defined flags.

Type parameters ​

NameDescription
TThe enum type to inspect.

Parameters ​

NameDescription
allowMaxEqualAllIf true, treats MaxValue as equivalent to "all flags set" when the enum's underlying type is Int32.

Returns ​

True if the enum defines a value that represents all flags combined; otherwise, false.

Remarks ​

Useful for checking if an [Flags] enum includes an explicit value like All = A | B | C, or if int.MaxValue is accepted as "all". This overload ignores the actual value.

bool HasAllFlag(out long allFlagValue, bool allowMaxEqualAll = null) ​

csharp
bool HasAllFlag(out long allFlagValue, bool allowMaxEqualAll = null)

Determines whether the specified enum type includes a value that represents all defined flags, and returns the value if found.

Type parameters ​

NameDescription
TThe enum type to inspect.

Parameters ​

NameDescription
allFlagValueWhen this method returns, contains the enum value representing all flags, or -1 if no such value exists.
allowMaxEqualAllIf true, treats MaxValue as equivalent to "all flags set" when the enum's underlying type is Int32.

Returns ​

True if the enum defines a value that represents all flags combined; otherwise, false.

Remarks ​

This overload allows retrieving the actual numeric value that represents "all flags". This is helpful when generating UI controls or validating bitmask completeness.