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
value
objectThe value to convert.
result
TValueWhen this method returns, contains the converted value if the conversion succeeded, or the default value of
TValue
if the conversion failed.
Returns
- bool
true
if the conversion was successful; otherwise,false
.
Type Parameters
TValue
The type to which the value should be converted.