Utf8JsonReader.ValueTextEquals Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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. |
- Source:
- Utf8JsonReader.cs
- Source:
- Utf8JsonReader.cs
- 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
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
- Source:
- Utf8JsonReader.cs
- Source:
- Utf8JsonReader.cs
- 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
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
- Source:
- Utf8JsonReader.cs
- Source:
- Utf8JsonReader.cs
- 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
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: