JsonWriterOptions.SkipValidation 属性

定义

获取或设置一个值,该值指示 Utf8JsonWriter 是否应跳过结构验证并允许用户编写无效 JSON。Gets or sets a value that indicates whether the Utf8JsonWriter should skip structural validation and allow the user to write invalid JSON.

public:
 property bool SkipValidation { bool get(); void set(bool value); };
public bool SkipValidation { get; set; }
member this.SkipValidation : bool with get, set
Public Property SkipValidation As Boolean

属性值

Boolean

true 若要跳过结构验证并允许无效的 JSON,则为;如果 false InvalidOperationException 尝试编写无效的 JSON,则引发。true to skip structural validation and allow invalid JSON; false to throw an InvalidOperationException on any attempt to write invalid JSON.

注解

如果已知写入的 JSON 是正确的,则通过将此属性设置为来跳过验证 (, true) 可以提高性能。If the JSON being written is known to be correct, then skipping validation (by setting this property to true) could improve performance. 当设置) 为时,编写器将引发 (无效 JSON 的示例 SkipValidation false 。在没有属性名称的 JSON 对象中写入值时,将引发此异常。An example of invalid JSON where the writer will throw (when SkipValidation is set to false) is when you write a value within a JSON object without a property name.

适用于