Share via


ObjectAdapter.Replace(Operation, Object) Method

Definition

The "replace" operation replaces the value at the target location with a new value. The operation object MUST contain a "value" member whose content specifies the replacement value.

The target location MUST exist for the operation to be successful.

For example:

{ "op": "replace", "path": "/a/b/c", "value": 42 }

This operation is functionally identical to a "remove" operation for a value, followed immediately by an "add" operation at the same location with the replacement value.

Note: even though it's the same functionally, we do not call remove + add for performance reasons (multiple checks of same requirements).

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

Parameters

operation
Operation

The replace operation.

objectToApplyTo
Object

Object to apply the operation to.

Implements

Applies to