語言

JsonReaderState(JsonReaderOptions) 建構函式

定義

建立一個新的 JsonReaderState 實例。

public JsonReaderState(System.Text.Json.JsonReaderOptions options = default);
new System.Text.Json.JsonReaderState : System.Text.Json.JsonReaderOptions -> System.Text.Json.JsonReaderState
Public Sub New (Optional options As JsonReaderOptions = Nothing)

參數

options
JsonReaderOptions

定義了與 JSON RFC 不同的自訂行為 Utf8JsonReader (例如如何處理註解,或閱讀時允許的最大深度)。 預設情況下,它 Utf8JsonReader 嚴格遵循 JSON RFC(JSON 內的註解無效),並可讀取最高 64 深度。

例外狀況

最大深度設定為非正值(< 0)。

備註

必須將此狀態的實例與 JSON 資料一起傳給 Utf8JsonReader 建構子。 與 Utf8JsonReader為 ref struct 不同,該狀態能跨越非同步/等待邊界存活,因此此類型需要支援非同步讀取更多資料,然後再繼續新的實例 Utf8JsonReader。

適用於