TryParse Method
Definition
TryParse(string, out TResult)
Converts the input to its TResult equivalent. A return input indicates whether the conversion succeeded.
bool TryParse(string input, out TResult result)
Parameters
inputstringThe string to convert.
resultTResultWhen this method returns, contains the
TResultequivalent of theinput, if the conversion succeeded, ordefaultif the conversion failed.
Returns
- bool
trueifinputwas converted successfully; otherwise,false.