Utf8JsonWriter.WriteBoolean 方法

定義

多載

WriteBoolean(String, Boolean)

寫入屬性名稱 (指定為字串) 和 Boolean 值 (以 JSON 常值 truefalse),作為 JSON 物件名稱/值組的一部分。

WriteBoolean(ReadOnlySpan<Byte>, Boolean)

寫入屬性名稱 (指定為唯讀位元組範圍) 和 Boolean 值 (以 JSON 常值 truefalse),作為 JSON 物件名稱/值組的一部分。

WriteBoolean(ReadOnlySpan<Char>, Boolean)

寫入屬性名稱 (指定為唯讀字元範圍) 和 Boolean 值 (以 JSON 常值 truefalse),作為 JSON 物件名稱/值組的一部分。

WriteBoolean(JsonEncodedText, Boolean)

寫入預先編碼的屬性名稱和 Boolean 值 (以 JSON 常值 truefalse),作為 JSON 物件名稱/值組的一部分。

WriteBoolean(String, Boolean)

寫入屬性名稱 (指定為字串) 和 Boolean 值 (以 JSON 常值 truefalse),作為 JSON 物件名稱/值組的一部分。

public:
 void WriteBoolean(System::String ^ propertyName, bool value);
public void WriteBoolean (string propertyName, bool value);
member this.WriteBoolean : string * bool -> unit
Public Sub WriteBoolean (propertyName As String, value As Boolean)

參數

propertyName
String

要轉碼並寫入為 UTF-8 之 JSON 物件的 UTF-16 編碼屬性名稱。

value
Boolean

要寫入為 JSON 常值 truefalse 的值,做為名稱/值組的一部分。

例外狀況

指定的屬性名稱太大。

已啟用驗證,且作業會導致寫入無效的 JSON。

propertyName 參數為 null

備註

屬性名稱會在寫入之前逸出。

適用於

WriteBoolean(ReadOnlySpan<Byte>, Boolean)

寫入屬性名稱 (指定為唯讀位元組範圍) 和 Boolean 值 (以 JSON 常值 truefalse),作為 JSON 物件名稱/值組的一部分。

public:
 void WriteBoolean(ReadOnlySpan<System::Byte> utf8PropertyName, bool value);
public void WriteBoolean (ReadOnlySpan<byte> utf8PropertyName, bool value);
member this.WriteBoolean : ReadOnlySpan<byte> * bool -> unit
Public Sub WriteBoolean (utf8PropertyName As ReadOnlySpan(Of Byte), value As Boolean)

參數

utf8PropertyName
ReadOnlySpan<Byte>

要寫入之 JSON 物件的 UTF-8 編碼屬性名稱。

value
Boolean

要寫入為 JSON 常值 truefalse 的值,做為名稱/值組的一部分。

例外狀況

指定的屬性名稱太大。

已啟用驗證,且作業會導致寫入無效的 JSON。

備註

屬性名稱會在寫入之前逸出。

適用於

WriteBoolean(ReadOnlySpan<Char>, Boolean)

寫入屬性名稱 (指定為唯讀字元範圍) 和 Boolean 值 (以 JSON 常值 truefalse),作為 JSON 物件名稱/值組的一部分。

public:
 void WriteBoolean(ReadOnlySpan<char> propertyName, bool value);
public void WriteBoolean (ReadOnlySpan<char> propertyName, bool value);
member this.WriteBoolean : ReadOnlySpan<char> * bool -> unit
Public Sub WriteBoolean (propertyName As ReadOnlySpan(Of Char), value As Boolean)

參數

propertyName
ReadOnlySpan<Char>

要轉碼並寫入為 UTF-8 之 JSON 物件的 UTF-16 編碼屬性名稱。

value
Boolean

要寫入為 JSON 常值 truefalse 的值,做為名稱/值組的一部分。

例外狀況

指定的屬性名稱太大。

已啟用驗證,且作業會導致寫入無效的 JSON。

備註

屬性名稱會在寫入之前逸出。

適用於

WriteBoolean(JsonEncodedText, Boolean)

寫入預先編碼的屬性名稱和 Boolean 值 (以 JSON 常值 truefalse),作為 JSON 物件名稱/值組的一部分。

public:
 void WriteBoolean(System::Text::Json::JsonEncodedText propertyName, bool value);
public void WriteBoolean (System.Text.Json.JsonEncodedText propertyName, bool value);
member this.WriteBoolean : System.Text.Json.JsonEncodedText * bool -> unit
Public Sub WriteBoolean (propertyName As JsonEncodedText, value As Boolean)

參數

propertyName
JsonEncodedText

要轉碼並寫入為 UTF-8 之 JSON 物件的 JSON 編碼屬性名稱。

value
Boolean

要寫入為 JSON 常值 truefalse 的值,做為名稱/值組的一部分。

例外狀況

已啟用驗證,且此方法會導致寫入無效的 JSON。

備註

建立 的 JsonEncodedText 實例時,應該已經逸出屬性名稱。

適用於