JsonSerializerOptions.AddContext<TContext> Method
Definition
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.
Binds current JsonSerializerOptions instance with a new instance of the specified JsonSerializerContext type.
public:
generic <typename TContext>
where TContext : System::Text::Json::Serialization::JsonSerializerContextgcnew() void AddContext();
public void AddContext<TContext> () where TContext : System.Text.Json.Serialization.JsonSerializerContext, new();
member this.AddContext : unit -> unit (requires 'Context :> System.Text.Json.Serialization.JsonSerializerContext and 'Context : (new : unit -> 'Context))
Public Sub AddContext(Of TContext As {JsonSerializerContextNew}) ()
Type Parameters
- TContext
The generic definition of the specified context type.
Remarks
When serializing and deserializing types using the options instance, metadata for the types will be fetched from the context instance.