|
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: GSFAssembly: GSF.Core (in GSF.Core.dll) Version: 2.4.258-beta+f8b6aa3dbfe0b4cc2b0b0760dd5d2a3dd4f59d09
Syntaxpublic static string GetDescription(
this Enum enumeration,
bool defaultToName = true
)
[<ExtensionAttribute>]
static member GetDescription :
enumeration : Enum *
?defaultToName : bool
(* Defaults:
let _defaultToName = defaultArg defaultToName true
*)
-> string GSF.EnumExtensions.GetDescription = function(enumeration, defaultToName);
View SourceParameters
- 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