Skip to content

M_CodeJam_EnumHelper_TryParse__1

Andrew Koryavchenko edited this page Jul 4, 2017 · 5 revisions

EnumHelper.TryParse(TEnum) Method (String, Boolean)

Try to parse the enum value.

Namespace: CodeJam
Assembly: CodeJam (in CodeJam.dll) Version: 1.1.0.0 (1.1.0.0)

Syntax

C#

public static Nullable<TEnum> TryParse<TEnum>(
	string name,
	bool ignoreCase = false
)
where TEnum : struct, new(), IComparable, IFormattable, IConvertible

VB

Public Shared Function TryParse(Of TEnum As {Structure, New, IComparable, IFormattable, IConvertible}) ( 
	name As String,
	Optional ignoreCase As Boolean = false
) As Nullable(Of TEnum)

F#

static member TryParse : 
        name : string * 
        ?ignoreCase : bool 
(* Defaults:
        let _ignoreCase = defaultArg ignoreCase false
*)
-> Nullable<'TEnum>  when 'TEnum : struct, new() and IComparable and IFormattable and IConvertible

Parameters

 

name
Type: System.String
The name.
ignoreCase (Optional)
Type: System.Boolean
If set to true the case of the name will be ignored.

Type Parameters

 

TEnum
The type of the enum.

Return Value

Type: Nullable(TEnum)
Parsed value, if parsing was successful; null otherwise.

See Also

Reference

EnumHelper Class
TryParse Overload
CodeJam Namespace

Clone this wiki locally