Skip to content

JsonBoolean.Freeze Method

Definition

Namespace: Corvus.Text.Json.AsyncApi.Internal
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 JsonBoolean Freeze()

Returns

JsonBoolean

An immutable JsonBoolean 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

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