Common Logging 2.0 API Reference

ArgUtils.TryParseEnum(T) Method

Tries parsing stringValue into an enum of the type of defaultValue.

[Visual Basic]
Public Shared Sub TryParseEnum(Of T As {Structure, ValueType})( _
   ByVal defaultValue As T, _
   ByVal stringValue As String _
)
[C#]
public static T TryParseEnum<T>(
   T defaultValue,
   string stringValue
)
where T : struct, ValueType;

Parameters

defaultValue
the default value to return if parsing fails
stringValue
the string value to parse

Return Value

the successfully parsed value, defaultValue otherwise.

See Also

ArgUtils Class | Common.Logging.Configuration Namespace