JsonElement.ValueEquals Method

Definition

Overloads

ValueEquals(ReadOnlySpan<Byte>)

Compares the text represented by a UTF8-encoded byte span to the string value of this element.

ValueEquals(ReadOnlySpan<Char>)

Compares a specified read-only character span to the string value of this element.

ValueEquals(String)

Compares a specified string to the string value of this element.

ValueEquals(ReadOnlySpan<Byte>)

Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs

Compares the text represented by a UTF8-encoded byte span to the string value of this element.

C#
public bool ValueEquals(ReadOnlySpan<byte> utf8Text);

Parameters

utf8Text
ReadOnlySpan<Byte>

The UTF-8 encoded text to compare against.

Returns

true if the string value of this element has the same UTF-8 encoding as utf8Text; otherwise, false.

Exceptions

Remarks

This method is functionally equal to doing an ordinal comparison of the string produced by UTF-8 decoding utf8Text with the result of calling GetString(), but avoids creating the string instances.

Applies to

.NET 10 ja muud versioonid
Toode Versioonid
.NET Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

ValueEquals(ReadOnlySpan<Char>)

Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs

Compares a specified read-only character span to the string value of this element.

C#
public bool ValueEquals(ReadOnlySpan<char> text);

Parameters

text
ReadOnlySpan<Char>

The text to compare against.

Returns

true if the string value of this element matches text; otherwise, false.

Exceptions

Remarks

This method is functionally equal to doing an ordinal comparison of text and the result of calling GetString(), but avoids creating the string instance.

Applies to

.NET 10 ja muud versioonid
Toode Versioonid
.NET Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

ValueEquals(String)

Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs

Compares a specified string to the string value of this element.

C#
public bool ValueEquals(string? text);
C#
public bool ValueEquals(string text);

Parameters

text
String

The text to compare against.

Returns

true if the string value of this element matches text; otherwise, false.

Exceptions

Remarks

This method is functionally equal to doing an ordinal comparison of text and the result of calling GetString(), but avoids creating the string instance.

Applies to

.NET 10 ja muud versioonid
Toode Versioonid
.NET Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)