| ConversionHelpersTryParseEnumTEnum Method |
Converts input string value into Enum. Parsing is case-insensitive.
Namespace:
NLog.Common
Assembly:
NLog (in NLog.dll) Version: 5.3.4+73d83d3161d31288ca5c554cc50d27b6bed5f28b
Syntax public static bool TryParseEnum<TEnum>(
string inputValue,
out TEnum resultValue,
TEnum defaultValue = null
)
where TEnum : struct, new()
Public Shared Function TryParseEnum(Of TEnum As {Structure, New}) (
inputValue As String,
<OutAttribute> ByRef resultValue As TEnum,
Optional defaultValue As TEnum = Nothing
) As Boolean
Dim inputValue As String
Dim resultValue As TEnum
Dim defaultValue As TEnum
Dim returnValue As Boolean
returnValue = ConversionHelpers.TryParseEnum(inputValue,
resultValue, defaultValue)
static member TryParseEnum :
inputValue : string *
resultValue : 'TEnum byref *
?defaultValue : 'TEnum
(* Defaults:
let _defaultValue = defaultArg defaultValue null
*)
-> bool when 'TEnum : struct, new()
Parameters
- inputValue
- Type: SystemString
Input value - resultValue
- Type: TEnum
Output value - defaultValue (Optional)
- Type: TEnum
Default value
Type Parameters
- TEnum
Return Value
Type:
BooleanReturns false if the input value could not be parsed
See Also