Click or drag to resize

EnumExtensionsGetDescription Method

Retrieves the description of the value that this Enum represents extracted from the DescriptionAttribute, or the enumeration name if no description is available.

Namespace: GSF
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.218-beta+101eee949414e414795e55a6e73d88938f0177b8
Syntax
public static string GetDescription(
	this Enum enumeration,
	bool defaultToName = true
)
View Source

Parameters

enumeration  Enum
Enum to operate on.
defaultToName  Boolean  (Optional)
When true, return enum name when no description attribute exists; otherwise, return null.

Return Value

String
Description of the Enum if specified, otherwise the String representation of this enumeration or null if defaultToName is false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Enum. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also