JsonSerializerOptions.PreferredObjectCreationHandling Property

Definition

Gets or sets the preferred object creation handling for properties when deserializing JSON.

public:
 property System::Text::Json::Serialization::JsonObjectCreationHandling PreferredObjectCreationHandling { System::Text::Json::Serialization::JsonObjectCreationHandling get(); void set(System::Text::Json::Serialization::JsonObjectCreationHandling value); };
public System.Text.Json.Serialization.JsonObjectCreationHandling PreferredObjectCreationHandling { get; set; }
member this.PreferredObjectCreationHandling : System.Text.Json.Serialization.JsonObjectCreationHandling with get, set
Public Property PreferredObjectCreationHandling As JsonObjectCreationHandling

Property Value

When set to Populate, all properties that are capable of reusing the existing instance will be populated.

Remarks

Only property type is taken into consideration. For example, if a property is of type IEnumerable<T> but it is assigned List<T>, it won't be populated because IEnumerable<T> is not capable of populating. Additionally, value types require a setter to be populated.

Applies to