Skip to content

[S.T.J] Removed unused field in JsonProperty #114071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public readonly struct JsonProperty
/// The value of this property.
/// </summary>
public JsonElement Value { get; }
private string? _name { get; }

internal JsonProperty(JsonElement value)
{
Expand All @@ -25,8 +24,9 @@ internal JsonProperty(JsonElement value)

/// <summary>
/// The name of this property.
/// This allocates a new string instance for each call.
/// </summary>
public string Name => _name ?? Value.GetPropertyName();
public string Name => Value.GetPropertyName();

/// <summary>
/// Compares <paramref name="text" /> to the name of this property.
Expand Down Expand Up @@ -116,15 +116,7 @@ public void WriteTo(Utf8JsonWriter writer)
{
ArgumentNullException.ThrowIfNull(writer);

if (_name is null)
{
Value.WritePropertyNameTo(writer);
}
else
{
writer.WritePropertyName(_name);
}

Value.WritePropertyNameTo(writer);
Value.WriteTo(writer);
}

Expand Down
Loading