Interface IParser<TResult>
Defines methods that converts a string to a generic object of TResult.
public interface IParser<TResult>
Type Parameters
TResultThe type of the converted result.
Methods
Parse(string)
Converts the input to its TResult equivalent.
TResult Parse(string input)
Parameters
inputstringThe string to convert.
Returns
- TResult
A
TResultequivalent toinput.
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.