ISpanParsable<TSelf>.TryParse Method

Definition

Tries to parse a span of characters into a value.

public static abstract bool TryParse (ReadOnlySpan<char> s, IFormatProvider? provider, out TSelf result);

Parameters

s
ReadOnlySpan<Char>

The span of characters to parse.

provider
IFormatProvider

An object that provides culture-specific formatting information about s.

result
TSelf

When this method returns, contains the result of successfully parsing s, or an undefined value on failure.

Returns

true if s was successfully parsed; otherwise, false.

Applies to

Product Versions
.NET 7, 8, 9