JsonObject.Add Method

Definition

Overloads

Add(KeyValuePair<String,JsonValue>)

Adds an item to the ICollection<T>.

Add(String, JsonValue)

Adds an element with the provided key and value to the IDictionary<TKey,TValue>.

Add(KeyValuePair<String,JsonValue>)

Source:
JsonObject.cs

Adds an item to the ICollection<T>.

C#
public void Add(System.Collections.Generic.KeyValuePair<string,System.Json.JsonValue> pair);

Parameters

Implements

Remarks

Note

The System.Json namespace was designed for Silverlight, which is no longer supported. For processing JSON, we recommend using APIs in the System.Text.Json namespace instead.

Applies to

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

Add(String, JsonValue)

Source:
JsonObject.cs

Adds an element with the provided key and value to the IDictionary<TKey,TValue>.

C#
public void Add(string key, System.Json.JsonValue value);

Parameters

key
String

The object to use as the key of the element to add.

value
JsonValue

The object to use as the value of the element to add.

Implements

Remarks

Note

The System.Json namespace was designed for Silverlight, which is no longer supported. For processing JSON, we recommend using APIs in the System.Text.Json namespace instead.

Applies to

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