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