Table of Contents

Enum ReferencePreservationMode

Namespace
Nerdbank.Json
Assembly
Nerdbank.Json.dll

Controls whether reference equality is preserved in serialized object graphs.

public enum ReferencePreservationMode

Fields

AllowCycles = 2

Repeated references are preserved and reference cycles are allowed.

This mode uses the same $id/$ref wire format as RejectCycles, but additionally permits an object to reference itself directly or indirectly. During deserialization, mutable objects, collections, and dictionaries are registered before their members are populated so that back-references resolve to the object under construction. Immutable or constructor-bound objects cannot be registered early, so a back-reference to such an object that is still being constructed fails with a clear error.

Off = 0

References are not preserved.

RejectCycles = 1

Repeated references are preserved and reference cycles are rejected.