Utf8JsonWriter.WriteString 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| 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, Guid) |
將屬性名稱寫成字串,並將 Guid 值(以 JSON 字串)寫入 JSON 物件的名稱/值對。 |
| WriteString(String, DateTimeOffset) |
將屬性名稱寫成字串,並將 DateTimeOffset 值(以 JSON 字串)寫入 JSON 物件的名稱/值對。 |
| WriteString(String, DateTime) |
將屬性名稱寫成字串,並將 DateTime 值(以 JSON 字串)寫入 JSON 物件的名稱/值對。 |
| WriteString(String, ReadOnlySpan<Byte>) |
將屬性名稱寫成字串,並以 UTF-8 文字值(以 JSON 字串)作為 JSON 物件名稱/值對的一部分。 |
| WriteString(ReadOnlySpan<Char>, String) |
將 UTF-16 屬性名稱和字串文字值(以 JSON 字串形式)寫入 JSON 物件的名稱/值對。 |
| WriteString(ReadOnlySpan<Byte>, DateTime) |
它會寫入 UTF-8 屬性名稱和 DateTime 一個值(以 JSON 字串形式)作為 JSON 物件名稱/值對的一部分。 |
| WriteString(ReadOnlySpan<Char>, JsonEncodedText) |
將屬性名稱和預先編碼的值(以 JSON 字串形式)寫入 JSON 物件的名稱/值對中。 |
| WriteString(ReadOnlySpan<Byte>, Guid) |
它會寫入 UTF-8 屬性名稱和 Guid 一個值(以 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>, DateTimeOffset) |
它會寫入 UTF-8 屬性名稱和 DateTimeOffset 一個值(以 JSON 字串形式)作為 JSON 物件名稱/值對的一部分。 |
| WriteString(ReadOnlySpan<Char>, DateTime) |
寫入一個屬性名稱,指定為唯讀字元範圍,並以 JSON 字串形式寫入 DateTime 一個值,作為 JSON 物件的名稱/值對。 |
| WriteString(ReadOnlySpan<Char>, DateTimeOffset) |
寫入一個屬性名稱,指定為唯讀字元範圍,並以 JSON 字串形式寫入 DateTimeOffset 一個值,作為 JSON 物件的名稱/值對。 |
| WriteString(ReadOnlySpan<Char>, Guid) |
寫入一個屬性名稱,指定為唯讀字元範圍,並以 JSON 字串形式寫入 Guid 一個值,作為 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)
將預先編碼的屬性名稱和預編碼的值(以 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 編碼屬性名稱。
- value
- JsonEncodedText
JSON 編碼的值則以 UTF-8 轉碼的 JSON 字串作為名稱/值對的一部分。
例外狀況
已啟用驗證,寫入操作會產生無效的 JSON。
備註
在建立 的 JsonEncodedText 實例時,屬性名稱和值應該已經逃逸。
適用於
WriteString(JsonEncodedText, String)
將預先編碼的屬性名稱和字串文字值(以 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 編碼屬性名稱。
- value
- String
該值將以 UTF-8 轉碼的 JSON 字串作為名稱/值對的一部分寫入。
例外狀況
指定的值太大了。
已啟用驗證,寫入操作會產生無效的 JSON。
備註
在建立 的 JsonEncodedText 實例時,屬性名稱應該已經脫離了。
該價值在寫入前已逃離。
若 value 是 null,則寫入 JSON 空值 ,就像 WriteNull(JsonEncodedText) 方法被呼叫一樣。
適用於
WriteString(JsonEncodedText, ReadOnlySpan<Char>)
將預先編碼的屬性名稱和文字值(以 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 編碼屬性名稱。
- value
- ReadOnlySpan<Char>
該值將以 UTF-8 轉碼的 JSON 字串作為名稱/值對的一部分寫入。
例外狀況
指定的值太大了。
已啟用驗證,寫入操作會產生無效的 JSON。
備註
在建立 的 JsonEncodedText 實例時,屬性名稱應該已經脫離了。
該價值在寫入前已逃離。
若 value 是 null,則寫入 JSON 空值 ,就像 WriteNull(JsonEncodedText) 方法被呼叫一樣。
適用於
WriteString(JsonEncodedText, ReadOnlySpan<Byte>)
將預先編碼的屬性名稱和 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 編碼屬性名稱。
- utf8Value
- ReadOnlySpan<Byte>
UTF-8 編碼的值將以 JSON 字串形式寫入,作為名稱/值對的一部分。
例外狀況
指定的值太大了。
已啟用驗證,寫入操作會產生無效的 JSON。
備註
在建立 的 JsonEncodedText 實例時,屬性名稱應該已經脫離了。
該價值在寫入前已逃離。
適用於
WriteString(JsonEncodedText, Guid)
將預先編碼的屬性名稱和 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 編碼屬性名稱。
- value
- Guid
這個值要以 JSON 字串的形式寫成,作為名稱/值對的一部分。
例外狀況
已啟用驗證,寫入操作會產生無效的 JSON。
備註
使用預設StandardFormat值(即「D」)寫出 ,Guid形式為:nnnnnnnn-nnnn-nnnn-nnnn-nn。
在建立 的 JsonEncodedText 實例時,屬性名稱應該已經脫離了。
適用於
WriteString(JsonEncodedText, DateTimeOffset)
將預先編碼的屬性名稱和 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 編碼屬性名稱。
- value
- DateTimeOffset
這個值要以 JSON 字串的形式寫成,作為名稱/值對的一部分。
例外狀況
已啟用驗證,寫入操作會產生無效的 JSON。
備註
以 ISO 8601-1 擴展格式寫入( DateTimeOffset 參見 System.Text.JSON 中的 DateTime 與 DateTimeOffset 支援);例如,2017-06-12T05:30:45.7680000-07:00。
在建立 的 JsonEncodedText 實例時,屬性名稱應該已經脫離了。
適用於
WriteString(JsonEncodedText, DateTime)
將預先編碼的屬性名稱和 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 編碼屬性名稱。
- value
- DateTime
這個值要以 JSON 字串的形式寫成,作為名稱/值對的一部分。
例外狀況
已啟用驗證,寫入操作會產生無效的 JSON。
備註
使用 ISO 8601-1 擴充格式寫入 ( DateTime 參見 System.Text.JSON 中的 DateTime 與 DateTimeOffset 支援);例如,2017-06-12T05:30:45.7680000。
在建立 的 JsonEncodedText 實例時,屬性名稱應該已經脫離了。
適用於
WriteString(String, JsonEncodedText)
將屬性名稱和預先編碼的值(以 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
JSON 編碼的值則以 UTF-8 轉碼的 JSON 字串作為名稱/值對的一部分。
例外狀況
指定的物業名稱太大。
已啟用驗證,寫入操作會產生無效的 JSON。
參數 propertyName 為 null。
備註
當 的實例建立時 JsonEncodedText ,該值應該已經被逃逸。
在寫字前,房產名稱就已經被遺漏了。
適用於
WriteString(String, String)
它會將屬性名稱(以字串形式)和字串文字值(以 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-16 編碼值則以 UTF-8 轉碼的 JSON 字串作為名稱/值對的一部分。
例外狀況
指定的房產名稱或價值過大。
已啟用驗證,寫入操作會產生無效的 JSON。
參數 propertyName 為 null。
備註
在書寫前,財產名稱和價值會被刪除。
若 value 是 null,則寫入 JSON 空值 ,就像 WriteNull(String) 方法被呼叫一樣。
適用於
WriteString(String, ReadOnlySpan<Char>)
它會將屬性名稱以字串形式指定,並以 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-16 編碼值則以 UTF-8 轉碼的 JSON 字串作為名稱/值對的一部分。
例外狀況
指定的房產名稱或價值過大。
已啟用驗證,寫入操作會產生無效的 JSON。
參數 propertyName 為 null。
備註
在書寫前,財產名稱和價值會被刪除。
適用於
WriteString(String, Guid)
將屬性名稱寫成字串,並將 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。
備註
使用預設StandardFormat值(即「D」)寫出 ,Guid形式為:nnnnnnnn-nnnn-nnnn-nnnn-nn。 在寫字前,房產名稱就已經被遺漏了。
適用於
WriteString(String, DateTimeOffset)
將屬性名稱寫成字串,並將 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。
備註
以 ISO 8601-1 擴展格式寫入( DateTimeOffset 參見 System.Text.JSON 中的 DateTime 與 DateTimeOffset 支援);例如,2017-06-12T05:30:45.7680000-07:00。
在寫字前,房產名稱就已經被遺漏了。
適用於
WriteString(String, DateTime)
將屬性名稱寫成字串,並將 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。
備註
使用 ISO 8601-1 擴充格式寫入 ( DateTime 參見 System.Text.JSON 中的 DateTime 與 DateTimeOffset 支援);例如,2017-06-12T05:30:45.7680000。
在寫字前,房產名稱就已經被遺漏了。
適用於
WriteString(String, ReadOnlySpan<Byte>)
將屬性名稱寫成字串,並以 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>
UTF-8 編碼的值將以 JSON 字串形式寫入,作為名稱/值對的一部分。
例外狀況
指定的房產名稱或價值過大。
已啟用驗證,寫入操作會產生無效的 JSON。
參數 propertyName 為 null。
備註
在書寫前,財產名稱和價值會被刪除。
適用於
WriteString(ReadOnlySpan<Char>, String)
將 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-16 編碼值則以 UTF-8 轉碼的 JSON 字串作為名稱/值對的一部分。
例外狀況
指定的房產名稱或價值過大。
已啟用驗證,寫入操作會產生無效的 JSON。
備註
在書寫前,財產名稱和價值會被刪除。
若 value 是 null,則寫入 JSON 空值 ,就像 WriteNull(ReadOnlySpan<Char>) 方法被呼叫一樣。
適用於
WriteString(ReadOnlySpan<Byte>, DateTime)
它會寫入 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。
備註
使用 ISO 8601-1 擴充格式寫入 ( DateTime 參見 System.Text.JSON 中的 DateTime 與 DateTimeOffset 支援);例如,2017-06-12T05:30:45.7680000。
在寫字前,房產名稱就已經被遺漏了。
適用於
WriteString(ReadOnlySpan<Char>, JsonEncodedText)
將屬性名稱和預先編碼的值(以 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
JSON 編碼的值則以 UTF-8 轉碼的 JSON 字串作為名稱/值對的一部分。
例外狀況
指定的物業名稱太大。
已啟用驗證,寫入操作會產生無效的 JSON。
備註
當 的實例建立時 JsonEncodedText ,該值應該已經被逃逸。
在寫字前,房產名稱就已經被遺漏了。
適用於
WriteString(ReadOnlySpan<Byte>, Guid)
它會寫入 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。
備註
使用預設StandardFormat值(即「D」)寫出 ,Guid形式為:nnnnnnnn-nnnn-nnnn-nnnn-nn。 在寫字前,房產名稱就已經被遺漏了。
適用於
WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)
將 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>
UTF-8 編碼的值將以 JSON 字串形式寫入,作為名稱/值對的一部分。
例外狀況
指定的房產名稱或價值過大。
已啟用驗證,寫入操作會產生無效的 JSON。
備註
在書寫前,財產名稱和價值會被刪除。
適用於
WriteString(ReadOnlySpan<Byte>, ReadOnlySpan<Char>)
將 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-16 編碼值則以 UTF-8 轉碼的 JSON 字串作為名稱/值對的一部分。
例外狀況
指定的房產名稱或價值過大。
已啟用驗證,寫入操作會產生無效的 JSON。
備註
在書寫前,財產名稱和價值會被刪除。
適用於
WriteString(ReadOnlySpan<Byte>, String)
將 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-16 編碼值則以 UTF-8 轉碼的 JSON 字串作為名稱/值對的一部分。
例外狀況
指定的房產名稱或價值過大。
已啟用驗證,寫入操作會產生無效的 JSON。
備註
在書寫前,財產名稱和價值會被刪除。
若 value 是 null,則寫入 JSON 空值 ,就像 WriteNull(ReadOnlySpan<Byte>) 方法被呼叫一樣。
適用於
WriteString(ReadOnlySpan<Byte>, DateTimeOffset)
它會寫入 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。
備註
以 ISO 8601-1 擴展格式寫入( DateTimeOffset 參見 System.Text.JSON 中的 DateTime 與 DateTimeOffset 支援);例如,2017-06-12T05:30:45.7680000-07:00。
在寫字前,房產名稱就已經被遺漏了。
適用於
WriteString(ReadOnlySpan<Char>, DateTime)
寫入一個屬性名稱,指定為唯讀字元範圍,並以 JSON 字串形式寫入 DateTime 一個值,作為 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。
備註
使用 ISO 8601-1 擴充格式寫入 ( DateTime 參見 System.Text.JSON 中的 DateTime 與 DateTimeOffset 支援);例如,2017-06-12T05:30:45.7680000。
在寫字前,房產名稱就已經被遺漏了。
適用於
WriteString(ReadOnlySpan<Char>, DateTimeOffset)
寫入一個屬性名稱,指定為唯讀字元範圍,並以 JSON 字串形式寫入 DateTimeOffset 一個值,作為 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。
備註
以 ISO 8601-1 擴展格式寫入( DateTimeOffset 參見 System.Text.JSON 中的 DateTime 與 DateTimeOffset 支援);例如,2017-06-12T05:30:45.7680000-07:00。
在寫字前,房產名稱就已經被遺漏了。
適用於
WriteString(ReadOnlySpan<Char>, Guid)
寫入一個屬性名稱,指定為唯讀字元範圍,並以 JSON 字串形式寫入 Guid 一個值,作為 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。
備註
使用預設StandardFormat值(即「D」)寫出 ,Guid形式為:nnnnnnnn-nnnn-nnnn-nnnn-nn。 在寫字前,房產名稱就已經被遺漏了。
適用於
WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)
將 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>
UTF-8 編碼的值將以 JSON 字串形式寫入,作為名稱/值對的一部分。
例外狀況
指定的房產名稱或價值過大。
已啟用驗證,寫入操作會產生無效的 JSON。
備註
在書寫前,財產名稱和價值會被刪除。
適用於
WriteString(ReadOnlySpan<Char>, ReadOnlySpan<Char>)
將 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-16 編碼值則以 UTF-8 轉碼的 JSON 字串作為名稱/值對的一部分。
例外狀況
指定的房產名稱或價值過大。
已啟用驗證,寫入操作會產生無效的 JSON。
備註
在書寫前,財產名稱和價值會被刪除。
適用於
WriteString(ReadOnlySpan<Byte>, JsonEncodedText)
將 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
JSON 編碼的值則以 UTF-8 轉碼的 JSON 字串作為名稱/值對的一部分。
例外狀況
指定的物業名稱太大。
已啟用驗證,若此方法會寫入無效 JSON。
備註
當 的實例建立時 JsonEncodedText ,該值應該已經被逃逸。
在寫字前,房產名稱就已經被遺漏了。