Table of Contents

Class EnumExtensions

Namespace
NanoByte.Common.Values
Assembly
NanoByte.Common.dll

Contains extension methods for System.Enums.

public static class EnumExtensions
Inheritance
object
EnumExtensions

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 Enum
flag Enum

Returns

bool

HasFlag(int, int)

Checks whether a flag is set.

[Pure]
public static bool HasFlag(this int enumRef, int flag)

Parameters

enumRef int
flag 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 ushort
flag ushort

Returns

bool