JsonNode.Item[] Property

Definition

Overloads

Item[Int32]

Gets or sets the element at the specified index.

Item[String]

Gets or sets the element with the specified property name. If the property is not found, null is returned.

Item[Int32]

Source:
JsonNode.cs
Source:
JsonNode.cs
Source:
JsonNode.cs
Source:
JsonNode.cs
Source:
JsonNode.cs
Source:
JsonNode.cs

Gets or sets the element at the specified index.

C#
public System.Text.Json.Nodes.JsonNode? this[int index] { get; set; }

Parameters

index
Int32

The zero-based index of the element to get or set.

Property Value

Exceptions

index is less than 0 or index is greater than the number of properties.

Applies to

.NET 10 and other versions
Product Versions
.NET 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

Item[String]

Source:
JsonNode.cs
Source:
JsonNode.cs
Source:
JsonNode.cs
Source:
JsonNode.cs
Source:
JsonNode.cs
Source:
JsonNode.cs

Gets or sets the element with the specified property name. If the property is not found, null is returned.

C#
public System.Text.Json.Nodes.JsonNode? this[string propertyName] { get; set; }

Parameters

propertyName
String

The name of the property to return.

Property Value

Exceptions

propertyName is null.

Applies to

.NET 10 and other versions
Product Versions
.NET 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)