JsonSerializerOptions.IgnoreNullValues 屬性

定義

警告

JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.

取得或設定值,指出序列化和還原序列化期間是否 null 忽略值。 預設值是 false

public:
 property bool IgnoreNullValues { bool get(); void set(bool value); };
public bool IgnoreNullValues { get; set; }
[System.Obsolete("JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.", DiagnosticId="SYSLIB0020", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public bool IgnoreNullValues { get; set; }
member this.IgnoreNullValues : bool with get, set
[<System.Obsolete("JsonSerializerOptions.IgnoreNullValues is obsolete. To ignore null values when serializing, set DefaultIgnoreCondition to JsonIgnoreCondition.WhenWritingNull.", DiagnosticId="SYSLIB0020", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.IgnoreNullValues : bool with get, set
Public Property IgnoreNullValues As Boolean

屬性值

true 如果在序列化和還原序列化期間忽略 Null 值,則為 ;否則為 false

屬性

例外狀況

此屬性是在序列化或還原序列化發生後設定的。

-或-

DefaultIgnoreCondition 已設定為非預設值。 這些屬性不能同時使用。

備註

如需詳細資訊,請參閱 如何忽略屬性

適用於