Cuemon .NET Framework
TryParse<TEnum>(String,Boolean,TEnum) Method

The type of the enumeration to convert.
A string containing the name or value to convert.
true to ignore case; false to regard case.
When this method returns, result contains an object of type TEnum whose value is represented by value if the parse operation succeeds. If the parse operation fails, result contains the default value of the underlying type of TEnum.
Converts the specified value of the name or numeric value of one or more enumerated constants to an equivalent enumerated object. A parameter specifies whether the operation is case-sensitive. The return value indicates whether the conversion succeeded.
Syntax
'Declaration
 
Public Overloads Shared Function TryParse(Of TEnum As {New, IConvertible, Struct})( _
   ByVal value As String, _
   ByVal ignoreCase As Boolean, _
   ByRef result As TEnum _
) As Boolean
public static bool TryParse<TEnum>( 
   string value,
   bool ignoreCase,
   out TEnum result
)
where TEnum: new(), IConvertible, struct

Parameters

value
A string containing the name or value to convert.
ignoreCase
true to ignore case; false to regard case.
result
When this method returns, result contains an object of type TEnum whose value is represented by value if the parse operation succeeds. If the parse operation fails, result contains the default value of the underlying type of TEnum.

Type Parameters

TEnum
The type of the enumeration to convert.

Return Value

true if the value parameter was converted successfully; otherwise, false.
Requirements

Target Platforms: Windows 8, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

EnumUtility Class
EnumUtility Members
Overload List

 

 


| Cuemon is licensed under a The MIT License (MIT)



© 2009-2015 Weubphoria. All Rights Reserved.

Documentation made easy with Document! X by Innovasys

Send Feedback