JsonSerializerOptions.MakeReadOnly Method

Definition

Overloads

MakeReadOnly()

Marks the current instance as read-only to prevent any further user modification.

MakeReadOnly(Boolean)

Marks the current instance as read-only preventing any further user modification.

MakeReadOnly()

Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs

Marks the current instance as read-only to prevent any further user modification.

public:
 void MakeReadOnly();
public void MakeReadOnly ();
member this.MakeReadOnly : unit -> unit
Public Sub MakeReadOnly ()

Exceptions

The instance does not specify a TypeInfoResolver setting.

Remarks

This method is idempotent.

Applies to

MakeReadOnly(Boolean)

Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs

Marks the current instance as read-only preventing any further user modification.

public:
 void MakeReadOnly(bool populateMissingResolver);
public void MakeReadOnly (bool populateMissingResolver);
member this.MakeReadOnly : bool -> unit
Public Sub MakeReadOnly (populateMissingResolver As Boolean)

Parameters

populateMissingResolver
Boolean

Populates unconfigured TypeInfoResolver properties with the reflection-based default.

Exceptions

The instance does not specify a TypeInfoResolver setting. Thrown when populateMissingResolver is false.

-or-

The IsReflectionEnabledByDefault feature switch has been turned off.

Remarks

When populateMissingResolver is set to true, configures the instance following the semantics of the JsonSerializer methods accepting JsonSerializerOptions parameters.

This method is idempotent.

Applies to