JsonSerializerOptions.MakeReadOnly Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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. |
- Source:
- JsonSerializerOptions.cs
- Source:
- JsonSerializerOptions.cs
- Source:
- JsonSerializerOptions.cs
- 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
.NET 10 and other versions
Product | Versions |
---|---|
.NET | 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10 |
.NET Standard | 2.0 (package-provided) |
- Source:
- JsonSerializerOptions.cs
- Source:
- JsonSerializerOptions.cs
- Source:
- JsonSerializerOptions.cs
- 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
.NET 10 and other versions
Product | Versions |
---|---|
.NET | 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10 |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: