Table of Contents

TryParse Method

Definition

Namespace
Cuemon.Text
Assemblies
Cuemon.Kernel.dll
Source
src/Cuemon.Kernel/Text/IParser.cs

TryParse<T>(string, out T)

Converts the specified input to an object of T. A return value indicates whether the conversion succeeded.

bool TryParse<T>(string input, out T result)

Parameters

input string

The string to convert.

result T

When this method returns, contains the object of T equivalent to input, if the conversion succeeded, or default if the conversion failed.

Returns

bool

true if input was converted successfully; otherwise, false.

Type Parameters

T

The type of the object to return.

TryParse(string, Type, out object)

Converts the specified input to an object of targetType. A return value indicates whether the conversion succeeded.

bool TryParse(string input, Type targetType, out object result)

Parameters

input string

The string to convert.

targetType Type

The type of the object to return.

result object

When this method returns, contains the object of targetType equivalent to input, if the conversion succeeded, or default if the conversion failed.

Returns

bool

true if input was converted successfully; otherwise, false.