JsonSerializerOptions.PreferredObjectCreationHandling 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定還原序列化 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
屬性值
當設定為 Populate 時,將會填入能夠重複使用現有實例的所有屬性。
備註
只會考慮屬性類型。 例如,如果屬性的類型為 IEnumerable<T> ,但已 List<T> 指派 ,則不會填入,因為 IEnumerable<T> 無法填入。 此外,實值型別需要填入 setter。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應