|
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.218-beta+101eee949414e414795e55a6e73d88938f0177b8
Syntax public 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