JsonObject.SetAt Method

Definition

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.

Overloads

SetAt(Int32, String, JsonNode)

Sets a new property at the specified index.

SetAt(Int32, JsonNode)

Sets a new property value at the specified index.

SetAt(Int32, String, JsonNode)

Source:
JsonObject.IList.cs
Source:
JsonObject.IList.cs

Sets a new property at the specified index.

C#
public void SetAt(int index, string propertyName, System.Text.Json.Nodes.JsonNode? value);

Parameters

index
Int32

The zero-based index of the property to set.

propertyName
String

The property name to store at the specified index.

value
JsonNode

The JSON value to store at the specified index.

Exceptions

index is less than 0 or greater than or equal to Count.

propertyName is already specified in a different index.

value already has a parent.

Applies to

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

SetAt(Int32, JsonNode)

Source:
JsonObject.IList.cs
Source:
JsonObject.IList.cs

Sets a new property value at the specified index.

C#
public void SetAt(int index, System.Text.Json.Nodes.JsonNode? value);

Parameters

index
Int32

The zero-based index of the property to set.

value
JsonNode

The JSON value to store at the specified index.

Exceptions

index is less than 0 or greater than or equal to Count.

value already has a parent.

Applies to

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