JsonArray.Insert(Int32, JsonNode) Method

Definition

Inserts an element into the JsonArray at the specified index.

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

Parameters

index
Int32

The zero-based index at which item should be inserted.

item
JsonNode

The JsonNode to insert.

Implements

Exceptions

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

Applies to

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