Utf8JsonWriter.WriteStringValue 方法

定義

多載

WriteStringValue(String)

寫入字串文字值 (以 JSON 字串),作為 JSON 陣列的項目。

WriteStringValue(DateTime)

寫入 DateTime 值 (以 JSON 字串),作為 JSON 陣列的項目。

WriteStringValue(DateTimeOffset)

寫入 DateTimeOffset 值 (以 JSON 字串),作為 JSON 陣列的項目。

WriteStringValue(Guid)

寫入 Guid 值 (以 JSON 字串),作為 JSON 陣列的項目。

WriteStringValue(ReadOnlySpan<Byte>)

寫入 UTF-8 文字值 (以 JSON 字串),作為 JSON 陣列的項目。

WriteStringValue(ReadOnlySpan<Char>)

寫入 UTF-16 文字值 (以 JSON 字串),作為 JSON 陣列的項目。

WriteStringValue(JsonEncodedText)

寫入預先編碼的文字值 (以 JSON 字串),作為 JSON 陣列的元素。

WriteStringValue(String)

來源:
Utf8JsonWriter.WriteValues.String.cs
來源:
Utf8JsonWriter.WriteValues.String.cs
來源:
Utf8JsonWriter.WriteValues.String.cs

寫入字串文字值 (以 JSON 字串),作為 JSON 陣列的項目。

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

參數

value
String

要以UTF-8 轉碼 JSON 字串寫入作為 JSON 陣列元素的 UTF-16 編碼值。

例外狀況

指定的值太大。

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

備註

值會在寫入之前逸出。

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

適用於

WriteStringValue(DateTime)

來源:
Utf8JsonWriter.WriteValues.DateTime.cs
來源:
Utf8JsonWriter.WriteValues.DateTime.cs
來源:
Utf8JsonWriter.WriteValues.DateTime.cs

寫入 DateTime 值 (以 JSON 字串),作為 JSON 陣列的項目。

public:
 void WriteStringValue(DateTime value);
public void WriteStringValue (DateTime value);
member this.WriteStringValue : DateTime -> unit
Public Sub WriteStringValue (value As DateTime)

參數

value
DateTime

要以 JSON 字串寫入作為 JSON 陣列元素的值。

例外狀況

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

備註

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

適用於

WriteStringValue(DateTimeOffset)

來源:
Utf8JsonWriter.WriteValues.DateTimeOffset.cs
來源:
Utf8JsonWriter.WriteValues.DateTimeOffset.cs
來源:
Utf8JsonWriter.WriteValues.DateTimeOffset.cs

寫入 DateTimeOffset 值 (以 JSON 字串),作為 JSON 陣列的項目。

public:
 void WriteStringValue(DateTimeOffset value);
public void WriteStringValue (DateTimeOffset value);
member this.WriteStringValue : DateTimeOffset -> unit
Public Sub WriteStringValue (value As DateTimeOffset)

參數

value
DateTimeOffset

要以 JSON 字串寫入作為 JSON 陣列元素的值。

例外狀況

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

備註

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

適用於

WriteStringValue(Guid)

來源:
Utf8JsonWriter.WriteValues.Guid.cs
來源:
Utf8JsonWriter.WriteValues.Guid.cs
來源:
Utf8JsonWriter.WriteValues.Guid.cs

寫入 Guid 值 (以 JSON 字串),作為 JSON 陣列的項目。

public:
 void WriteStringValue(Guid value);
public void WriteStringValue (Guid value);
member this.WriteStringValue : Guid -> unit
Public Sub WriteStringValue (value As Guid)

參數

value
Guid

要以 JSON 字串寫入作為 JSON 陣列元素的值。

例外狀況

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

備註

這個方法 Guid 會使用預設 StandardFormat (寫入值,也就是 'D') 格式:nn-nnnn-nnnn-nnnn-nn。

適用於

WriteStringValue(ReadOnlySpan<Byte>)

來源:
Utf8JsonWriter.WriteValues.String.cs
來源:
Utf8JsonWriter.WriteValues.String.cs
來源:
Utf8JsonWriter.WriteValues.String.cs

寫入 UTF-8 文字值 (以 JSON 字串),作為 JSON 陣列的項目。

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

參數

utf8Value
ReadOnlySpan<Byte>

要以 JSON 字串寫入作為 JSON 陣列元素的 UTF-8 編碼值。

例外狀況

指定的值太大。

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

備註

值會在寫入之前逸出。

適用於

WriteStringValue(ReadOnlySpan<Char>)

來源:
Utf8JsonWriter.WriteValues.String.cs
來源:
Utf8JsonWriter.WriteValues.String.cs
來源:
Utf8JsonWriter.WriteValues.String.cs

寫入 UTF-16 文字值 (以 JSON 字串),作為 JSON 陣列的項目。

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

參數

value
ReadOnlySpan<Char>

要以UTF-8 轉碼 JSON 字串寫入作為 JSON 陣列元素的 UTF-16 編碼值。

例外狀況

指定的值太大。

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

備註

值會在寫入之前逸出。

適用於

WriteStringValue(JsonEncodedText)

來源:
Utf8JsonWriter.WriteValues.String.cs
來源:
Utf8JsonWriter.WriteValues.String.cs
來源:
Utf8JsonWriter.WriteValues.String.cs

寫入預先編碼的文字值 (以 JSON 字串),作為 JSON 陣列的元素。

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

參數

value
JsonEncodedText

要以 UTF-8 轉碼 JSON 字串寫入作為 JSON 陣列元素的 JSON 編碼值。

例外狀況

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

備註

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

適用於