|
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.220-beta+a56b2444ff27b37e053039e60f062b99378309bd
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