Skip to content

JsonPointer.Freeze Method

Definition

Namespace: Corvus.Text.Json.Patch
Assembly: Corvus.Text.Json.dll

Freeze()

Creates a frozen (immutable) copy of this element if it is backed by a mutable document, or returns this instance if it is already immutable.

public JsonPointer Freeze()

Returns

JsonPointer

An immutable JsonPointer that lives for the lifetime of its workspace and its associated documents.

Remarks

Unlike Clone, which serializes the element and re-parses it into a standalone heap-allocated document, Freeze() performs a cheap blit of the metadata and value backing arrays. The resulting element is immutable but is only valid for the lifetime of the workspace. If this instance is already backed by an immutable document, it is returned as-is.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests.

Open an issue