Click or drag to resize

EnumExtension Methods

The EnumExtension type exposes the following members.

Methods
 NameDescription
Public Extension MethodGetAttributeTAttribute This method retrieves a specific attribute (TAttribute) associated with the given enum value. It returns the attribute instance if found, or null if the attribute is not present.
Public Extension MethodGetDescriptionTEnum This method retrieves the description attribute value associated with the given enum value. If a description attribute is defined for the enum value, it returns the description value. Otherwise, it returns the string representation of the enum value.
Public methodStatic memberGetEnumValueFromDescriptionTEnum This method searches for an enum value that has a description attribute matching the provided descriptionValue. It iterates through all values of the specified enum type and compares their descriptions. If a match is found, it returns the corresponding enum value. If no matching value is found, it throws an ArgumentException indicating that no enum value matches the given description attribute value.
Top
See Also