Skip to content

JsonProperty<TValue>.NameEquals Method

Definition

Namespace: Corvus.Text.Json
Assembly: Corvus.Text.Json.dll

Overloads

Method Description
NameEquals(string) Compares text to the name of this property.
NameEquals(ReadOnlySpan<byte>) Compares the text represented by utf8Text to the name of this property.
NameEquals(ReadOnlySpan<char>) Compares text to the name of this property.

NameEquals(string)

Source: JsonProperty.cs

Compares text to the name of this property.

public bool NameEquals(string text)

Parameters

Name Type Description
text string The text to compare against.

Returns

bool

true if the name of this property matches text, false otherwise.

Exceptions

Exception Description
InvalidOperationException This value's Type is not PropertyName.

Remarks

This method is functionally equal to doing an ordinal comparison of text and Name, but can avoid creating the string instance.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

NameEquals(ReadOnlySpan<byte>)

Source: JsonProperty.cs

Compares the text represented by utf8Text to the name of this property.

public bool NameEquals(ReadOnlySpan<byte> utf8Text)

Parameters

Name Type Description
utf8Text ReadOnlySpan<byte> The UTF-8 encoded text to compare against.

Returns

bool

true if the name of this property has the same UTF-8 encoding as utf8Text, false otherwise.

Exceptions

Exception Description
InvalidOperationException This value's Type is not PropertyName.

Remarks

This method is functionally equal to doing an ordinal comparison of utf8Text and Utf8NameSpan, but can avoid creating the UTF8 string instance.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

NameEquals(ReadOnlySpan<char>)

Source: JsonProperty.cs

Compares text to the name of this property.

public bool NameEquals(ReadOnlySpan<char> text)

Parameters

Name Type Description
text ReadOnlySpan<char> The text to compare against.

Returns

bool

true if the name of this property matches text, false otherwise.

Exceptions

Exception Description
InvalidOperationException This value's Type is not PropertyName.

Remarks

This method is functionally equal to doing an ordinal comparison of utf8Text and Utf8NameSpan, but can avoid creating the UTF-8 string instance.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests.

Open an issue