Table of Contents

Class EnumExtensions

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

Contains extension methods for Enums.

public static class EnumExtensions
Inheritance
object
EnumExtensions

Methods

GetEnumAttribute<TAttribute>(Enum)

Gets the first TAttribute attribute set on the value enum value.

public static TAttribute? GetEnumAttribute<TAttribute>(this Enum value) where TAttribute : notnull, Attribute

Parameters

value Enum

Returns

TAttribute

Type Parameters

TAttribute

HasFlag(Enum, Enum)

Checks whether a flag is set.

public static bool HasFlag(this Enum value, Enum flag)

Parameters

value Enum
flag Enum

Returns

bool

HasFlag(int, int)

Checks whether a flag is set.

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)]
public static bool HasFlag(this ushort enumRef, ushort flag)

Parameters

enumRef ushort
flag ushort

Returns

bool