Show / Hide Table of Contents

Class EnumType

Provides reflection helpers for enum types.

Inheritance
object
EnumType
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.Reflection
Assembly: DotNext.dll
Syntax
public static class EnumType

Methods

| Edit this page View Source

GetCustomAttribute<TEnum, TAttribute>(TEnum)

Gets custom attribute associated with the specified enum value.

Declaration
public static TAttribute? GetCustomAttribute<TEnum, TAttribute>(this TEnum value) where TEnum : struct, Enum where TAttribute : Attribute
Parameters
Type Name Description
TEnum value

The value to be reflected.

Returns
Type Description
TAttribute

A custom attribute that matches TAttribute, or null if no such attribute is found.

Type Parameters
Name Description
TEnum

The type of the enum to be reflected.

TAttribute

The type of attribute to search for.

| Edit this page View Source

GetCustomAttributes<TEnum, TAttribute>(TEnum)

Gets custom attributes associated with the specified enum value.

Declaration
public static IEnumerable<TAttribute> GetCustomAttributes<TEnum, TAttribute>(this TEnum value) where TEnum : struct, Enum where TAttribute : Attribute
Parameters
Type Name Description
TEnum value

The value to be reflected.

Returns
Type Description
IEnumerable<TAttribute>

A collection of the custom attributes associated with value.

Type Parameters
Name Description
TEnum

The type of the enum to be reflected.

TAttribute

The type of attribute to search for.

  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾