Method TryConvert
TryConvert<TValue>(object, out TValue?)
Attempts to convert the specified value to type TValue.
public static bool TryConvert<TValue>(object value, out TValue? result)
Parameters
valueobjectThe value to convert.
resultTValueWhen this method returns, contains the converted value if the conversion succeeded, or the default value of
TValueif the conversion failed.
Returns
- bool
trueif the conversion was successful; otherwise,false.
Type Parameters
TValueThe type to which the value should be converted.