Utf8JsonWriter.WriteString 方法

定義

多載

WriteString(JsonEncodedText, JsonEncodedText)

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

WriteString(JsonEncodedText, String)

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

WriteString(JsonEncodedText, ReadOnlySpan<Char>)

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

WriteString(JsonEncodedText, ReadOnlySpan<Byte>)

寫入預先編碼的屬性名稱和 UTF-8 文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

WriteString(JsonEncodedText, Guid)

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

WriteString(JsonEncodedText, DateTimeOffset)

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

WriteString(JsonEncodedText, DateTime)

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

WriteString(String, JsonEncodedText)

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

WriteString(String, String)

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

WriteString(String, ReadOnlySpan<Char>)

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

WriteString(String, ReadOnlySpan<Byte>)

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

WriteString(String, DateTimeOffset)

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

WriteString(String, DateTime)

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

WriteString(String, Guid)

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

WriteString(ReadOnlySpan<Char>, String)

寫入 UTF-16 屬性名稱和字串文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

WriteString(ReadOnlySpan<Byte>, DateTime)

寫入 UTF-8 屬性名稱和 DateTime 值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

WriteString(ReadOnlySpan<Byte>, DateTimeOffset)

寫入 UTF-8 屬性名稱和 DateTimeOffset 值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

WriteString(ReadOnlySpan<Char>, JsonEncodedText)

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

WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

寫入 UTF-8 屬性名稱和 UTF-8 文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Char>)

寫入 UTF-8 屬性名稱和 UTF-16 文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

WriteString(ReadOnlySpan<Byte>, String)

寫入 UTF-8 屬性名稱和字串文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

WriteString(ReadOnlySpan<Byte>, Guid)

寫入 UTF-8 屬性名稱和 Guid 值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

WriteString(ReadOnlySpan<Char>, DateTime)

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

WriteString(ReadOnlySpan<Char>, DateTimeOffset)

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

WriteString(ReadOnlySpan<Char>, Guid)

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

WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)

寫入 UTF-16 屬性名稱和 UTF-8 文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Char>)

寫入 UTF-16 屬性名稱和 UTF-16 文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

WriteString(ReadOnlySpan<Byte>, JsonEncodedText)

寫入 UTF-8 屬性名稱和預先編碼的值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

WriteString(JsonEncodedText, JsonEncodedText)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

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

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

參數

propertyName
JsonEncodedText

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

value
JsonEncodedText

要以 UTF-8 轉碼 JSON 字串寫入作為名稱/值組一部分的 JSON 編碼值。

例外狀況

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

備註

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

適用於

WriteString(JsonEncodedText, String)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

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

public:
 void WriteString(System::Text::Json::JsonEncodedText propertyName, System::String ^ value);
public void WriteString (System.Text.Json.JsonEncodedText propertyName, string? value);
public void WriteString (System.Text.Json.JsonEncodedText propertyName, string value);
member this.WriteString : System.Text.Json.JsonEncodedText * string -> unit
Public Sub WriteString (propertyName As JsonEncodedText, value As String)

參數

propertyName
JsonEncodedText

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

value
String

要以 UTF-8 轉碼 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

指定的值太大。

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

備註

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

值會在寫入之前逸出。

如果 為 valuenull ,則會寫入 JSON Null 值,就像 WriteNull(JsonEncodedText) 呼叫 方法一樣。

適用於

WriteString(JsonEncodedText, ReadOnlySpan<Char>)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

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

public:
 void WriteString(System::Text::Json::JsonEncodedText propertyName, ReadOnlySpan<char> value);
public void WriteString (System.Text.Json.JsonEncodedText propertyName, ReadOnlySpan<char> value);
member this.WriteString : System.Text.Json.JsonEncodedText * ReadOnlySpan<char> -> unit
Public Sub WriteString (propertyName As JsonEncodedText, value As ReadOnlySpan(Of Char))

參數

propertyName
JsonEncodedText

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

value
ReadOnlySpan<Char>

要以 UTF-8 轉碼 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

指定的值太大。

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

備註

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

值會在寫入之前逸出。

如果 為 valuenull ,則會寫入 JSON Null 值,就像 WriteNull(JsonEncodedText) 呼叫 方法一樣。

適用於

WriteString(JsonEncodedText, ReadOnlySpan<Byte>)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

寫入預先編碼的屬性名稱和 UTF-8 文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

public:
 void WriteString(System::Text::Json::JsonEncodedText propertyName, ReadOnlySpan<System::Byte> utf8Value);
public void WriteString (System.Text.Json.JsonEncodedText propertyName, ReadOnlySpan<byte> utf8Value);
member this.WriteString : System.Text.Json.JsonEncodedText * ReadOnlySpan<byte> -> unit
Public Sub WriteString (propertyName As JsonEncodedText, utf8Value As ReadOnlySpan(Of Byte))

參數

propertyName
JsonEncodedText

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

utf8Value
ReadOnlySpan<Byte>

要以 JSON 字串寫入作為名稱/值組一部分的 UTF-8 編碼值。

例外狀況

指定的值太大。

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

備註

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

值會在寫入之前逸出。

適用於

WriteString(JsonEncodedText, Guid)

來源:
Utf8JsonWriter.WriteProperties.Guid.cs
來源:
Utf8JsonWriter.WriteProperties.Guid.cs
來源:
Utf8JsonWriter.WriteProperties.Guid.cs

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

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

參數

propertyName
JsonEncodedText

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

value
Guid

要以 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

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

備註

Guid使用預設 StandardFormat (寫入 ,格式為 'D') :nnnnnn-nnnn-nnnn-nnnn-nn。

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

適用於

WriteString(JsonEncodedText, DateTimeOffset)

來源:
Utf8JsonWriter.WriteProperties.DateTimeOffset.cs
來源:
Utf8JsonWriter.WriteProperties.DateTimeOffset.cs
來源:
Utf8JsonWriter.WriteProperties.DateTimeOffset.cs

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

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

參數

propertyName
JsonEncodedText

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

value
DateTimeOffset

要以 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

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

備註

DateTimeOffset使用 ISO 8601-1 擴充格式寫入 (請參閱System.Text.Json) 中的 DateTime 和 DateTimeOffset 支援;例如,2017-06-12T05:30:45.7680000-07:00。

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

適用於

WriteString(JsonEncodedText, DateTime)

來源:
Utf8JsonWriter.WriteProperties.DateTime.cs
來源:
Utf8JsonWriter.WriteProperties.DateTime.cs
來源:
Utf8JsonWriter.WriteProperties.DateTime.cs

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

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

參數

propertyName
JsonEncodedText

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

value
DateTime

要以 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

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

備註

DateTime使用 ISO 8601-1 擴充格式寫入 (請參閱System.Text.Json) 中的 DateTime 和 DateTimeOffset 支援;例如,2017-06-12T05:30:45.7680000。

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

適用於

WriteString(String, JsonEncodedText)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

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

public:
 void WriteString(System::String ^ propertyName, System::Text::Json::JsonEncodedText value);
public void WriteString (string propertyName, System.Text.Json.JsonEncodedText value);
member this.WriteString : string * System.Text.Json.JsonEncodedText -> unit
Public Sub WriteString (propertyName As String, value As JsonEncodedText)

參數

propertyName
String

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

value
JsonEncodedText

要以 UTF-8 轉碼 JSON 字串寫入作為名稱/值組一部分的 JSON 編碼值。

例外狀況

指定的屬性名稱太大。

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

propertyName 參數為 null

備註

建立 的 JsonEncodedText 實例時,應該已經逸出值。

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

適用於

WriteString(String, String)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

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

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

參數

propertyName
String

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

value
String

要以 UTF-8 轉碼 JSON 字串寫入作為名稱/值組一部分的 UTF-16 編碼值。

例外狀況

指定的屬性名稱或值太大。

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

propertyName 參數為 null

備註

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

如果 為 valuenull ,則會寫入 JSON Null 值,就像 WriteNull(String) 呼叫 方法一樣。

適用於

WriteString(String, ReadOnlySpan<Char>)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

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

public:
 void WriteString(System::String ^ propertyName, ReadOnlySpan<char> value);
public void WriteString (string propertyName, ReadOnlySpan<char> value);
member this.WriteString : string * ReadOnlySpan<char> -> unit
Public Sub WriteString (propertyName As String, value As ReadOnlySpan(Of Char))

參數

propertyName
String

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

value
ReadOnlySpan<Char>

要以 UTF-8 轉碼 JSON 字串寫入作為名稱/值組一部分的 UTF-16 編碼值。

例外狀況

指定的屬性名稱或值太大。

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

propertyName 參數為 null

備註

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

適用於

WriteString(String, ReadOnlySpan<Byte>)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

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

public:
 void WriteString(System::String ^ propertyName, ReadOnlySpan<System::Byte> utf8Value);
public void WriteString (string propertyName, ReadOnlySpan<byte> utf8Value);
member this.WriteString : string * ReadOnlySpan<byte> -> unit
Public Sub WriteString (propertyName As String, utf8Value As ReadOnlySpan(Of Byte))

參數

propertyName
String

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

utf8Value
ReadOnlySpan<Byte>

要以 JSON 字串寫入作為名稱/值組一部分的 UTF-8 編碼值。

例外狀況

指定的屬性名稱或值太大。

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

propertyName 參數為 null

備註

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

適用於

WriteString(String, DateTimeOffset)

來源:
Utf8JsonWriter.WriteProperties.DateTimeOffset.cs
來源:
Utf8JsonWriter.WriteProperties.DateTimeOffset.cs
來源:
Utf8JsonWriter.WriteProperties.DateTimeOffset.cs

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

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

參數

propertyName
String

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

value
DateTimeOffset

要以 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

指定的屬性名稱太大。

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

propertyName 參數為 null

備註

DateTimeOffset使用 ISO 8601-1 擴充格式寫入 (請參閱System.Text.Json) 中的 DateTime 和 DateTimeOffset 支援;例如,2017-06-12T05:30:45.7680000-07:00。

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

適用於

WriteString(String, DateTime)

來源:
Utf8JsonWriter.WriteProperties.DateTime.cs
來源:
Utf8JsonWriter.WriteProperties.DateTime.cs
來源:
Utf8JsonWriter.WriteProperties.DateTime.cs

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

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

參數

propertyName
String

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

value
DateTime

要以 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

指定的屬性名稱太大。

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

propertyName 參數為 null

備註

DateTime使用 ISO 8601-1 擴充格式寫入 (請參閱System.Text.Json) 中的 DateTime 和 DateTimeOffset 支援;例如,2017-06-12T05:30:45.7680000。

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

適用於

WriteString(String, Guid)

來源:
Utf8JsonWriter.WriteProperties.Guid.cs
來源:
Utf8JsonWriter.WriteProperties.Guid.cs
來源:
Utf8JsonWriter.WriteProperties.Guid.cs

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

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

參數

propertyName
String

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

value
Guid

要以 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

指定的屬性名稱太大。

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

propertyName 參數為 null

備註

Guid使用預設 StandardFormat (寫入 ,格式為 'D') :nnnnnn-nnnn-nnnn-nnnn-nn。 屬性名稱會在寫入之前逸出。

適用於

WriteString(ReadOnlySpan<Char>, String)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

寫入 UTF-16 屬性名稱和字串文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

public:
 void WriteString(ReadOnlySpan<char> propertyName, System::String ^ value);
public void WriteString (ReadOnlySpan<char> propertyName, string? value);
public void WriteString (ReadOnlySpan<char> propertyName, string value);
member this.WriteString : ReadOnlySpan<char> * string -> unit
Public Sub WriteString (propertyName As ReadOnlySpan(Of Char), value As String)

參數

propertyName
ReadOnlySpan<Char>

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

value
String

要以 UTF-8 轉碼 JSON 字串寫入作為名稱/值組一部分的 UTF-16 編碼值。

例外狀況

指定的屬性名稱或值太大。

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

備註

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

如果 為 valuenull ,則會寫入 JSON Null 值,就像 WriteNull(ReadOnlySpan<Char>) 呼叫 方法一樣。

適用於

WriteString(ReadOnlySpan<Byte>, DateTime)

來源:
Utf8JsonWriter.WriteProperties.DateTime.cs
來源:
Utf8JsonWriter.WriteProperties.DateTime.cs
來源:
Utf8JsonWriter.WriteProperties.DateTime.cs

寫入 UTF-8 屬性名稱和 DateTime 值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

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

參數

utf8PropertyName
ReadOnlySpan<Byte>

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

value
DateTime

要以 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

指定的屬性名稱太大。

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

備註

DateTime使用 ISO 8601-1 擴充格式寫入 (請參閱System.Text.Json) 中的 DateTime 和 DateTimeOffset 支援;例如,2017-06-12T05:30:45.7680000。

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

適用於

WriteString(ReadOnlySpan<Byte>, DateTimeOffset)

來源:
Utf8JsonWriter.WriteProperties.DateTimeOffset.cs
來源:
Utf8JsonWriter.WriteProperties.DateTimeOffset.cs
來源:
Utf8JsonWriter.WriteProperties.DateTimeOffset.cs

寫入 UTF-8 屬性名稱和 DateTimeOffset 值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

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

參數

utf8PropertyName
ReadOnlySpan<Byte>

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

value
DateTimeOffset

要以 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

指定的屬性名稱太大。

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

備註

DateTimeOffset使用 ISO 8601-1 擴充格式寫入 (請參閱System.Text.Json) 中的 DateTime 和 DateTimeOffset 支援;例如,2017-06-12T05:30:45.7680000-07:00。

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

適用於

WriteString(ReadOnlySpan<Char>, JsonEncodedText)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

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

public:
 void WriteString(ReadOnlySpan<char> propertyName, System::Text::Json::JsonEncodedText value);
public void WriteString (ReadOnlySpan<char> propertyName, System.Text.Json.JsonEncodedText value);
member this.WriteString : ReadOnlySpan<char> * System.Text.Json.JsonEncodedText -> unit
Public Sub WriteString (propertyName As ReadOnlySpan(Of Char), value As JsonEncodedText)

參數

propertyName
ReadOnlySpan<Char>

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

value
JsonEncodedText

要以 UTF-8 轉碼 JSON 字串寫入作為名稱/值組一部分的 JSON 編碼值。

例外狀況

指定的屬性名稱太大。

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

備註

建立 的 JsonEncodedText 實例時,應該已經逸出值。

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

適用於

WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

寫入 UTF-8 屬性名稱和 UTF-8 文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

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

參數

utf8PropertyName
ReadOnlySpan<Byte>

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

utf8Value
ReadOnlySpan<Byte>

要以 JSON 字串寫入作為名稱/值組一部分的 UTF-8 編碼值。

例外狀況

指定的屬性名稱或值太大。

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

備註

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

適用於

WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Char>)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

寫入 UTF-8 屬性名稱和 UTF-16 文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

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

參數

utf8PropertyName
ReadOnlySpan<Byte>

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

value
ReadOnlySpan<Char>

要以 UTF-8 轉碼 JSON 字串寫入作為名稱/值組一部分的 UTF-16 編碼值。

例外狀況

指定的屬性名稱或值太大。

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

備註

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

適用於

WriteString(ReadOnlySpan<Byte>, String)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

寫入 UTF-8 屬性名稱和字串文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

public:
 void WriteString(ReadOnlySpan<System::Byte> utf8PropertyName, System::String ^ value);
public void WriteString (ReadOnlySpan<byte> utf8PropertyName, string? value);
public void WriteString (ReadOnlySpan<byte> utf8PropertyName, string value);
member this.WriteString : ReadOnlySpan<byte> * string -> unit
Public Sub WriteString (utf8PropertyName As ReadOnlySpan(Of Byte), value As String)

參數

utf8PropertyName
ReadOnlySpan<Byte>

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

value
String

要以 UTF-8 轉碼 JSON 字串寫入作為名稱/值組一部分的 UTF-16 編碼值。

例外狀況

指定的屬性名稱或值太大。

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

備註

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

如果 為 valuenull ,則會寫入 JSON Null 值,就像 WriteNull(ReadOnlySpan<Byte>) 呼叫 方法一樣。

適用於

WriteString(ReadOnlySpan<Byte>, Guid)

來源:
Utf8JsonWriter.WriteProperties.Guid.cs
來源:
Utf8JsonWriter.WriteProperties.Guid.cs
來源:
Utf8JsonWriter.WriteProperties.Guid.cs

寫入 UTF-8 屬性名稱和 Guid 值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

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

參數

utf8PropertyName
ReadOnlySpan<Byte>

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

value
Guid

要以 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

指定的屬性名稱太大。

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

備註

Guid使用預設 StandardFormat (寫入 ,格式為 'D') :nnnnnn-nnnn-nnnn-nnnn-nn。 屬性名稱會在寫入之前逸出。

適用於

WriteString(ReadOnlySpan<Char>, DateTime)

來源:
Utf8JsonWriter.WriteProperties.DateTime.cs
來源:
Utf8JsonWriter.WriteProperties.DateTime.cs
來源:
Utf8JsonWriter.WriteProperties.DateTime.cs

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

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

參數

propertyName
ReadOnlySpan<Char>

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

value
DateTime

要以 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

指定的屬性名稱太大。

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

備註

DateTime使用 ISO 8601-1 擴充格式寫入 (請參閱System.Text.Json) 中的 DateTime 和 DateTimeOffset 支援;例如,2017-06-12T05:30:45.7680000。

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

適用於

WriteString(ReadOnlySpan<Char>, DateTimeOffset)

來源:
Utf8JsonWriter.WriteProperties.DateTimeOffset.cs
來源:
Utf8JsonWriter.WriteProperties.DateTimeOffset.cs
來源:
Utf8JsonWriter.WriteProperties.DateTimeOffset.cs

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

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

參數

propertyName
ReadOnlySpan<Char>

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

value
DateTimeOffset

要以 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

指定的屬性名稱太大。

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

備註

DateTimeOffset使用 ISO 8601-1 擴充格式寫入 (請參閱System.Text.Json) 中的 DateTime 和 DateTimeOffset 支援;例如,2017-06-12T05:30:45.7680000-07:00。

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

適用於

WriteString(ReadOnlySpan<Char>, Guid)

來源:
Utf8JsonWriter.WriteProperties.Guid.cs
來源:
Utf8JsonWriter.WriteProperties.Guid.cs
來源:
Utf8JsonWriter.WriteProperties.Guid.cs

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

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

參數

propertyName
ReadOnlySpan<Char>

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

value
Guid

要以 JSON 字串寫入作為名稱/值組一部分的值。

例外狀況

指定的屬性名稱太大。

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

備註

Guid使用預設 StandardFormat (寫入 ,格式為 'D') :nnnnnn-nnnn-nnnn-nnnn-nn。 屬性名稱會在寫入之前逸出。

適用於

WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

寫入 UTF-16 屬性名稱和 UTF-8 文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

public:
 void WriteString(ReadOnlySpan<char> propertyName, ReadOnlySpan<System::Byte> utf8Value);
public void WriteString (ReadOnlySpan<char> propertyName, ReadOnlySpan<byte> utf8Value);
member this.WriteString : ReadOnlySpan<char> * ReadOnlySpan<byte> -> unit
Public Sub WriteString (propertyName As ReadOnlySpan(Of Char), utf8Value As ReadOnlySpan(Of Byte))

參數

propertyName
ReadOnlySpan<Char>

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

utf8Value
ReadOnlySpan<Byte>

要以 JSON 字串寫入作為名稱/值組一部分的 UTF-8 編碼值。

例外狀況

指定的屬性名稱或值太大。

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

備註

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

適用於

WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Char>)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

寫入 UTF-16 屬性名稱和 UTF-16 文字值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

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

參數

propertyName
ReadOnlySpan<Char>

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

value
ReadOnlySpan<Char>

要以 UTF-8 轉碼 JSON 字串寫入作為名稱/值組一部分的 UTF-16 編碼值。

例外狀況

指定的屬性名稱或值太大。

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

備註

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

適用於

WriteString(ReadOnlySpan<Byte>, JsonEncodedText)

來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs
來源:
Utf8JsonWriter.WriteProperties.String.cs

寫入 UTF-8 屬性名稱和預先編碼的值 (以 JSON 字串),作為 JSON 物件名稱/值組的一部分。

public:
 void WriteString(ReadOnlySpan<System::Byte> utf8PropertyName, System::Text::Json::JsonEncodedText value);
public void WriteString (ReadOnlySpan<byte> utf8PropertyName, System.Text.Json.JsonEncodedText value);
member this.WriteString : ReadOnlySpan<byte> * System.Text.Json.JsonEncodedText -> unit
Public Sub WriteString (utf8PropertyName As ReadOnlySpan(Of Byte), value As JsonEncodedText)

參數

utf8PropertyName
ReadOnlySpan<Byte>

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

value
JsonEncodedText

要以 UTF-8 轉碼 JSON 字串寫入作為名稱/值組一部分的 JSON 編碼值。

例外狀況

指定的屬性名稱太大。

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

備註

建立 的 JsonEncodedText 實例時,應該已經逸出值。

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

適用於