Editar

Compartilhar via


Utf8JsonReader.ValueTextEquals Method

Definition

Overloads

ValueTextEquals(ReadOnlySpan<Byte>)

Compares the UTF-8 encoded text in a read-only byte span to the unescaped JSON token value in the source and returns a value that indicates whether they match.

ValueTextEquals(ReadOnlySpan<Char>)

Compares the text in a read-only character span to the unescaped JSON token value in the source and returns a value that indicates whether they match.

ValueTextEquals(String)

Compares the string text to the unescaped JSON token value in the source and returns a value that indicates whether they match.

ValueTextEquals(ReadOnlySpan<Byte>)

Source:
Utf8JsonReader.cs
Source:
Utf8JsonReader.cs
Source:
Utf8JsonReader.cs

Compares the UTF-8 encoded text in a read-only byte span to the unescaped JSON token value in the source and returns a value that indicates whether they match.

public:
 bool ValueTextEquals(ReadOnlySpan<System::Byte> utf8Text);
public bool ValueTextEquals (ReadOnlySpan<byte> utf8Text);
public readonly bool ValueTextEquals (ReadOnlySpan<byte> utf8Text);
member this.ValueTextEquals : ReadOnlySpan<byte> -> bool
Public Function ValueTextEquals (utf8Text As ReadOnlySpan(Of Byte)) As Boolean

Parameters

utf8Text
ReadOnlySpan<Byte>

The UTF-8 encoded text to compare against.

Returns

true if the JSON token value in the source matches the UTF-8 encoded lookup text; otherwise, false.

Exceptions

The JSON token is not a JSON string (that is, it is not String or PropertyName).

Remarks

The lookup text must be valid UTF-8 text. Otherwise, this method could return true if the source has a string token containing invalid UTF-8 text that matches.

The comparison of the JSON token value in the source and the lookup text is done by first unescaping the JSON value in source, if required. The lookup text is matched as is, without any modifications to it.

Applies to

ValueTextEquals(ReadOnlySpan<Char>)

Source:
Utf8JsonReader.cs
Source:
Utf8JsonReader.cs
Source:
Utf8JsonReader.cs

Compares the text in a read-only character span to the unescaped JSON token value in the source and returns a value that indicates whether they match.

public:
 bool ValueTextEquals(ReadOnlySpan<char> text);
public bool ValueTextEquals (ReadOnlySpan<char> text);
public readonly bool ValueTextEquals (ReadOnlySpan<char> text);
member this.ValueTextEquals : ReadOnlySpan<char> -> bool
Public Function ValueTextEquals (text As ReadOnlySpan(Of Char)) As Boolean

Parameters

text
ReadOnlySpan<Char>

The text to compare against.

Returns

true if the JSON token value in the source matches the lookup text; otherwise, false.

Exceptions

The JSON token is not a JSON string (that is, it is not String or PropertyName).

Remarks

If the lookup text is invalid or incomplete UTF-16 text (that is, unpaired surrogates), the method returns false since you can't have invalid UTF-16 within the JSON payload.

The comparison of the JSON token value in the source and the lookup text is done by first unescaping the JSON value in source, if required. The lookup text is matched as is, without any modifications to it.

Applies to

ValueTextEquals(String)

Source:
Utf8JsonReader.cs
Source:
Utf8JsonReader.cs
Source:
Utf8JsonReader.cs

Compares the string text to the unescaped JSON token value in the source and returns a value that indicates whether they match.

public:
 bool ValueTextEquals(System::String ^ text);
public bool ValueTextEquals (string? text);
public readonly bool ValueTextEquals (string? text);
public bool ValueTextEquals (string text);
member this.ValueTextEquals : string -> bool
Public Function ValueTextEquals (text As String) As Boolean

Parameters

text
String

The text to compare against.

Returns

true if the JSON token value in the source matches the lookup text; otherwise, false.

Exceptions

The JSON token is not a JSON string (that is, it is not String or PropertyName).

Remarks

If the lookup text is invalid or incomplete UTF-16 text (that is, unpaired surrogates), the method returns false since you can't have invalid UTF-16 within the JSON payload.

The comparison of the JSON token value in the source and the lookup text is done by first unescaping the JSON value in source, if required. The lookup text is matched as is, without any modifications to it.

Applies to