Skip to content

DefaultValueJsonDocument Constructors

Definition

Namespace: Corvus.Text.Json.Internal
Assembly: Corvus.Text.Json.dll
Source: DefaultValueJsonDocument.cs

DefaultValueJsonDocument(IJsonDocument)

A read-only IMutableJsonDocument facade over an immutable document, used to back the mutable view of a schema default value (issue #811).

public DefaultValueJsonDocument(IJsonDocument inner)

Parameters

Name Type Description
inner IJsonDocument The immutable document that holds the default value.

Remarks

A mutable element (T.Mutable) must be backed by an IMutableJsonDocument, but a schema default is materialised as an immutable instance. This facade lets an absent, non-nullable defaulted property be surfaced through the mutable view without copying any data: every read is forwarded to the wrapped immutable inner document, and every mutating operation throws an InvalidOperationException whose message tells the caller to set the value on its parent before modifying it. This type owns no resources — it merely wraps inner — so Dispose is a no-op and never disposes the wrapped document.

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