Share via


IObjectAdapter.Add(Operation, Object) Method

Definition

Using the "add" operation a new value is inserted into the root of the target document, into the target array at the specified valid index, or to a target object at the specified location.

When adding to arrays, the specified index MUST NOT be greater than the number of elements in the array. To append the value to the array, the index of "-" character is used (see [RFC6901]).

When adding to an object, if an object member does not already exist, a new member is added to the object at the specified location or if an object member does exist, that member's value is replaced.

The operation object MUST contain a "value" member whose content specifies the value to be added.

For example:

{ "op": "add", "path": "/a/b/c", "value": [ "foo", "bar" ] }

See RFC 6902 https://tools.ietf.org/html/rfc6902#page-4

public:
 void Add(Microsoft::AspNetCore::JsonPatch::Operations::Operation ^ operation, System::Object ^ objectToApplyTo);
public void Add (Microsoft.AspNetCore.JsonPatch.Operations.Operation operation, object objectToApplyTo);
abstract member Add : Microsoft.AspNetCore.JsonPatch.Operations.Operation * obj -> unit
Public Sub Add (operation As Operation, objectToApplyTo As Object)

Parameters

operation
Operation

The add operation.

objectToApplyTo
Object

Object to apply the operation to.

Applies to