Utf8JsonWriter.WriteNumber 方法

定义

重载

WriteNumber(String, Int32)

编写指定为字符串的属性名称和 Int32 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and an Int32 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(String, Int64)

编写指定为字符串的属性名称和 Int64 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and an Int64 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(String, Single)

编写指定为字符串的属性名称和 Single 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and a Single value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(String, UInt32)

编写指定为字符串的属性名称和 UInt32 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and a UInt32 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(String, UInt64)

编写指定为字符串的属性名称和 UInt64 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and a UInt64 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(JsonEncodedText, UInt32)

将预编码的属性名称和 UInt32 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and UInt32 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(JsonEncodedText, Double)

将预编码的属性名称和 Double 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and Double value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(JsonEncodedText, Int32)

将预编码的属性名称和 Int32 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and Int32 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(JsonEncodedText, Int64)

将预编码的属性名称和 Int64 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and Int64 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(String, Double)

编写指定为字符串的属性名称和 Double 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and a Double value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(JsonEncodedText, UInt64)

将预编码的属性名称和 UInt64 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and UInt64 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(JsonEncodedText, Decimal)

将预编码的属性名称和 Decimal 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and Decimal value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(String, Decimal)

编写指定为字符串的属性名称和 Decimal 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and a Decimal value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(JsonEncodedText, Single)

将预编码的属性名称和 Single 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and Single value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Char>, UInt32)

编写指定为只读字符范围的属性名称和 UInt32 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and a UInt32 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Byte>, Decimal)

编写指定为字节只读范围的属性名称和 Decimal 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and a Decimal value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Byte>, Double)

编写指定为字节只读范围的属性名称和 Double 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and a Double value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Char>, UInt64)

编写指定为只读字符范围的属性名称和 UInt64 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and a UInt64 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Byte>, Int32)

编写指定为字节只读范围的属性名称和 Int32 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and an Int32 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Byte>, Int64)

编写指定为字节只读范围的属性名称和 Int64 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and an Int64 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Byte>, UInt32)

编写指定为字节只读范围的属性名称和 UInt32 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and a UInt32 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Byte>, Single)

编写指定为字节只读范围的属性名称和 Single 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and a Single value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Char>, Decimal)

编写指定为只读字符范围的属性名称和 Decimal 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and a Decimal value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Char>, Double)

编写指定为只读字符范围的属性名称和 Double 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and a Double value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Char>, Int32)

编写指定为只读字符范围的属性名称和 Int32 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and an Int32 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Char>, Int64)

编写指定为只读字符范围的属性名称和 Int64 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and an Int64 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Char>, Single)

编写指定为只读字符范围的属性名称和 Single 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and a Single value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(ReadOnlySpan<Byte>, UInt64)

编写指定为字节只读范围的属性名称和 UInt64 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and a UInt64 value (as a JSON number) as part of a name/value pair of a JSON object.

WriteNumber(String, Int32)

编写指定为字符串的属性名称和 Int32 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and an Int32 value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

propertyName
String

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Int32

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

propertyName 参数为 nullThe propertyName parameter is null.

注解

Int32使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the Int32 using the default StandardFormat (that is, 'G'); for example, 32767.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(String, Int64)

编写指定为字符串的属性名称和 Int64 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and an Int64 value (as a JSON number) as part of a name/value pair of a JSON object.

public:
 void WriteNumber(System::String ^ propertyName, long value);
public void WriteNumber (string propertyName, long value);
member this.WriteNumber : string * int64 -> unit
Public Sub WriteNumber (propertyName As String, value As Long)

参数

propertyName
String

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Int64

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

propertyName 参数为 nullThe propertyName parameter is null.

注解

Int64使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the Int64 using the default StandardFormat (that is, 'G'); for example, 32767.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(String, Single)

编写指定为字符串的属性名称和 Single 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and a Single value (as a JSON number) as part of a name/value pair of a JSON object.

public:
 void WriteNumber(System::String ^ propertyName, float value);
public void WriteNumber (string propertyName, float value);
member this.WriteNumber : string * single -> unit
Public Sub WriteNumber (propertyName As String, value As Single)

参数

propertyName
String

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Single

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

propertyName 参数为 nullThe propertyName parameter is null.

注解

使用在 Single StandardFormat .net Core 3.0 或更高版本上的默认 (为 "G" ) 来写入。Writes the Single using the default StandardFormat (that is, 'G') on .NET Core 3.0 or later versions. 在任何其他框架上使用 "G9"。Uses 'G9' on any other framework.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(String, UInt32)

重要

此 API 不符合 CLS。

编写指定为字符串的属性名称和 UInt32 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and a UInt32 value (as a JSON number) as part of a name/value pair of a JSON object.

public:
 void WriteNumber(System::String ^ propertyName, System::UInt32 value);
[System.CLSCompliant(false)]
public void WriteNumber (string propertyName, uint value);
[<System.CLSCompliant(false)>]
member this.WriteNumber : string * uint32 -> unit
Public Sub WriteNumber (propertyName As String, value As UInteger)

参数

propertyName
String

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
UInt32

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

属性

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

propertyName 参数为 nullThe propertyName parameter is null.

注解

UInt32使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the UInt32 using the default StandardFormat (that is, 'G'); for example, 32767.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(String, UInt64)

重要

此 API 不符合 CLS。

编写指定为字符串的属性名称和 UInt64 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and a UInt64 value (as a JSON number) as part of a name/value pair of a JSON object.

public:
 void WriteNumber(System::String ^ propertyName, System::UInt64 value);
[System.CLSCompliant(false)]
public void WriteNumber (string propertyName, ulong value);
[<System.CLSCompliant(false)>]
member this.WriteNumber : string * uint64 -> unit
Public Sub WriteNumber (propertyName As String, value As ULong)

参数

propertyName
String

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
UInt64

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

属性

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

propertyName 参数为 nullThe propertyName parameter is null.

注解

UInt64使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the UInt64 using the default StandardFormat (that is, 'G'); for example, 32767.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(JsonEncodedText, UInt32)

重要

此 API 不符合 CLS。

将预编码的属性名称和 UInt32 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and UInt32 value (as a JSON number) as part of a name/value pair of a JSON object.

public:
 void WriteNumber(System::Text::Json::JsonEncodedText propertyName, System::UInt32 value);
[System.CLSCompliant(false)]
public void WriteNumber (System.Text.Json.JsonEncodedText propertyName, uint value);
[<System.CLSCompliant(false)>]
member this.WriteNumber : System.Text.Json.JsonEncodedText * uint32 -> unit
Public Sub WriteNumber (propertyName As JsonEncodedText, value As UInteger)

参数

propertyName
JsonEncodedText

要进行转码并写为 UTF-8 的 JSON 对象的 JSON 编码属性名称。The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.

value
UInt32

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

属性

例外

系统已启用验证,此方法将导致编写无效的 JSON。Validation is enabled, and this method would result in writing invalid JSON.

注解

UInt32使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the UInt32 using the default StandardFormat (that is, 'G'); for example, 32767.

创建实例时,属性名称应已转义 JsonEncodedTextThe property name should already be escaped when the instance of JsonEncodedText was created.

适用于

WriteNumber(JsonEncodedText, Double)

将预编码的属性名称和 Double 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and Double value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

propertyName
JsonEncodedText

要进行转码并写为 UTF-8 的 JSON 对象的 JSON 编码属性名称。The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Double

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

系统已启用验证,此方法将导致编写无效的 JSON。Validation is enabled, and this method would result in writing invalid JSON.

注解

使用在 Double StandardFormat .net Core 3.0 或更高版本上的默认 (为 "G" ) 来写入。Writes the Double using the default StandardFormat (that is, 'G') on .NET Core 3.0 or later versions. 在任何其他框架上使用 "G17"。Uses 'G17' on any other framework.

创建实例时,属性名称应已转义 JsonEncodedTextThe property name should already be escaped when the instance of JsonEncodedText was created.

适用于

WriteNumber(JsonEncodedText, Int32)

将预编码的属性名称和 Int32 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and Int32 value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

propertyName
JsonEncodedText

要进行转码并写为 UTF-8 的 JSON 对象的 JSON 编码属性名称。The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Int32

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

系统已启用验证,此方法将导致编写无效的 JSON。Validation is enabled, and this method would result in writing invalid JSON.

注解

Int32使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the Int32 using the default StandardFormat (that is, 'G'); for example, 32767.

创建实例时,属性名称应已转义 JsonEncodedTextThe property name should already be escaped when the instance of JsonEncodedText was created.

适用于

WriteNumber(JsonEncodedText, Int64)

将预编码的属性名称和 Int64 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and Int64 value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

propertyName
JsonEncodedText

要进行转码并写为 UTF-8 的 JSON 对象的 JSON 编码属性名称。The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Int64

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

系统已启用验证,此方法将导致编写无效的 JSON。Validation is enabled, and this method would result in writing invalid JSON.

注解

Int64使用默认的 StandardFormat (,即 "G" ) ; 例如32767。Writes the Int64 using the default StandardFormat (this is, 'G'); for example, 32767.

创建实例时,属性名称应已转义 JsonEncodedTextThe property name should already be escaped when the instance of JsonEncodedText was created.

适用于

WriteNumber(String, Double)

编写指定为字符串的属性名称和 Double 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and a Double value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

propertyName
String

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Double

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

propertyName 参数为 nullThe propertyName parameter is null.

注解

使用在 Double StandardFormat .net Core 3.0 或更高版本上的默认 (为 "G" ) 来写入。Writes the Double using the default StandardFormat (that is, 'G') on .NET Core 3.0 or later versions. 在任何其他框架上使用 "G17"。Uses 'G17' on any other framework.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(JsonEncodedText, UInt64)

重要

此 API 不符合 CLS。

将预编码的属性名称和 UInt64 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and UInt64 value (as a JSON number) as part of a name/value pair of a JSON object.

public:
 void WriteNumber(System::Text::Json::JsonEncodedText propertyName, System::UInt64 value);
[System.CLSCompliant(false)]
public void WriteNumber (System.Text.Json.JsonEncodedText propertyName, ulong value);
[<System.CLSCompliant(false)>]
member this.WriteNumber : System.Text.Json.JsonEncodedText * uint64 -> unit
Public Sub WriteNumber (propertyName As JsonEncodedText, value As ULong)

参数

propertyName
JsonEncodedText

要进行转码并写为 UTF-8 的 JSON 对象的 JSON 编码属性名称。The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.

value
UInt64

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

属性

例外

系统已启用验证,此方法将导致编写无效的 JSON。Validation is enabled, and this method would result in writing invalid JSON.

注解

UInt64使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the UInt64 using the default StandardFormat (that is, 'G'); for example, 32767.

创建实例时,属性名称应已转义 JsonEncodedTextThe property name should already be escaped when the instance of JsonEncodedText was created.

适用于

WriteNumber(JsonEncodedText, Decimal)

将预编码的属性名称和 Decimal 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and Decimal value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

propertyName
JsonEncodedText

要进行转码并写为 UTF-8 的 JSON 对象的 JSON 编码属性名称。The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Decimal

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

系统已启用验证,此方法将导致编写无效的 JSON。Validation is enabled, and this method would result in writing invalid JSON.

注解

Decimal使用默认 (,即 StandardFormat "G" ) 写入。Writes the Decimal using the default StandardFormat (that is, 'G').

创建实例时,属性名称应已转义 JsonEncodedTextThe property name should already be escaped when the instance of JsonEncodedText was created.

适用于

WriteNumber(String, Decimal)

编写指定为字符串的属性名称和 Decimal 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a string and a Decimal value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

propertyName
String

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Decimal

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

propertyName 参数为 nullThe propertyName parameter is null.

注解

Decimal使用默认 (,即 StandardFormat "G" ) 写入。Writes the Decimal using the default StandardFormat (that is, 'G').

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(JsonEncodedText, Single)

将预编码的属性名称和 Single 值(作为 JSON 数字)写入 JSON 对象的名称/值对。Writes the pre-encoded property name and Single value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

propertyName
JsonEncodedText

要进行转码并写为 UTF-8 的 JSON 对象的 JSON 编码属性名称。The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Single

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

系统已启用验证,此方法将导致编写无效的 JSON。Validation is enabled, and this method would result in writing invalid JSON.

注解

使用在 Single StandardFormat .net Core 3.0 或更高版本上的默认 (为 "G" ) 来写入。Writes the Single using the default StandardFormat (that is, 'G') on .NET Core 3.0 or later versions. 在任何其他框架上使用 "G9"。Uses 'G9' on any other framework.

创建实例时,属性名称应已转义 JsonEncodedTextThe property name should already be escaped when the instance of JsonEncodedText was created.

适用于

WriteNumber(ReadOnlySpan<Char>, UInt32)

重要

此 API 不符合 CLS。

编写指定为只读字符范围的属性名称和 UInt32 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and a UInt32 value (as a JSON number) as part of a name/value pair of a JSON object.

public:
 void WriteNumber(ReadOnlySpan<char> propertyName, System::UInt32 value);
[System.CLSCompliant(false)]
public void WriteNumber (ReadOnlySpan<char> propertyName, uint value);
[<System.CLSCompliant(false)>]
member this.WriteNumber : ReadOnlySpan<char> * uint32 -> unit
Public Sub WriteNumber (propertyName As ReadOnlySpan(Of Char), value As UInteger)

参数

propertyName
ReadOnlySpan<Char>

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
UInt32

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

属性

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

UInt32使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the UInt32 using the default StandardFormat (that is, 'G'); for example, 32767.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(ReadOnlySpan<Byte>, Decimal)

编写指定为字节只读范围的属性名称和 Decimal 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and a Decimal value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

utf8PropertyName
ReadOnlySpan<Byte>

要编写的 JSON 对象的 UTF-8 编码属性名称。The UTF-8 encoded property name of the JSON object to be written.

value
Decimal

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

Decimal使用默认 (,即 StandardFormat "G" ) 写入。Writes the Decimal using the default StandardFormat (that is, 'G').

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(ReadOnlySpan<Byte>, Double)

编写指定为字节只读范围的属性名称和 Double 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and a Double value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

utf8PropertyName
ReadOnlySpan<Byte>

要编写的 JSON 对象的 UTF-8 编码属性名称。The UTF-8 encoded property name of the JSON object to be written.

value
Double

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

使用在 Double StandardFormat .net Core 3.0 或更高版本上的默认 (为 "G" ) 来写入。Writes the Double using the default StandardFormat (that is, 'G') on .NET Core 3.0 or later versions. 在任何其他框架上使用 "G17"。Uses 'G17' on any other framework.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(ReadOnlySpan<Char>, UInt64)

重要

此 API 不符合 CLS。

编写指定为只读字符范围的属性名称和 UInt64 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and a UInt64 value (as a JSON number) as part of a name/value pair of a JSON object.

public:
 void WriteNumber(ReadOnlySpan<char> propertyName, System::UInt64 value);
[System.CLSCompliant(false)]
public void WriteNumber (ReadOnlySpan<char> propertyName, ulong value);
[<System.CLSCompliant(false)>]
member this.WriteNumber : ReadOnlySpan<char> * uint64 -> unit
Public Sub WriteNumber (propertyName As ReadOnlySpan(Of Char), value As ULong)

参数

propertyName
ReadOnlySpan<Char>

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
UInt64

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

属性

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

UInt64使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the UInt64 using the default StandardFormat (that is, 'G'); for example, 32767.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(ReadOnlySpan<Byte>, Int32)

编写指定为字节只读范围的属性名称和 Int32 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and an Int32 value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

utf8PropertyName
ReadOnlySpan<Byte>

要编写的 JSON 对象的 UTF-8 编码属性名称。The UTF-8 encoded property name of the JSON object to be written.

value
Int32

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

Int32使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the Int32 using the default StandardFormat (that is, 'G'); for example, 32767.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(ReadOnlySpan<Byte>, Int64)

编写指定为字节只读范围的属性名称和 Int64 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and an Int64 value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

utf8PropertyName
ReadOnlySpan<Byte>

要编写的 JSON 对象的 UTF-8 编码属性名称。The UTF-8 encoded property name of the JSON object to be written.

value
Int64

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

Int64使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the Int64 using the default StandardFormat (that is, 'G'); for example, 32767.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(ReadOnlySpan<Byte>, UInt32)

重要

此 API 不符合 CLS。

编写指定为字节只读范围的属性名称和 UInt32 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and a UInt32 value (as a JSON number) as part of a name/value pair of a JSON object.

public:
 void WriteNumber(ReadOnlySpan<System::Byte> utf8PropertyName, System::UInt32 value);
[System.CLSCompliant(false)]
public void WriteNumber (ReadOnlySpan<byte> utf8PropertyName, uint value);
[<System.CLSCompliant(false)>]
member this.WriteNumber : ReadOnlySpan<byte> * uint32 -> unit
Public Sub WriteNumber (utf8PropertyName As ReadOnlySpan(Of Byte), value As UInteger)

参数

utf8PropertyName
ReadOnlySpan<Byte>

要编写的 JSON 对象的 UTF-8 编码属性名称。The UTF-8 encoded property name of the JSON object to be written.

value
UInt32

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

属性

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

UInt32使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the UInt32 using the default StandardFormat (that is, 'G'); for example, 32767.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(ReadOnlySpan<Byte>, Single)

编写指定为字节只读范围的属性名称和 Single 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and a Single value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

utf8PropertyName
ReadOnlySpan<Byte>

要编写的 JSON 对象的 UTF-8 编码属性名称。The UTF-8 encoded property name of the JSON object to be written.

value
Single

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

使用在 Single StandardFormat .net Core 3.0 或更高版本上的默认 (为 "G" ) 来写入。Writes the Single using the default StandardFormat (that is, 'G') on .NET Core 3.0 or later versions. 在任何其他框架上使用 "G9"。Uses 'G9' on any other framework.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(ReadOnlySpan<Char>, Decimal)

编写指定为只读字符范围的属性名称和 Decimal 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and a Decimal value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

propertyName
ReadOnlySpan<Char>

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Decimal

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

Decimal使用默认 (,即 StandardFormat "G" ) 写入。Writes the Decimal using the default StandardFormat (that is, 'G').

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(ReadOnlySpan<Char>, Double)

编写指定为只读字符范围的属性名称和 Double 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and a Double value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

propertyName
ReadOnlySpan<Char>

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Double

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

使用在 Double StandardFormat .net Core 3.0 或更高版本上的默认 (为 "G" ) 来写入。Writes the Double using the default StandardFormat (that is, 'G') on .NET Core 3.0 or later versions. 在任何其他框架上使用 "G17"。Uses 'G17' on any other framework.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(ReadOnlySpan<Char>, Int32)

编写指定为只读字符范围的属性名称和 Int32 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and an Int32 value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

propertyName
ReadOnlySpan<Char>

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Int32

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

Int32使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the Int32 using the default StandardFormat (that is, 'G'); for example, 32767.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(ReadOnlySpan<Char>, Int64)

编写指定为只读字符范围的属性名称和 Int64 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and an Int64 value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

propertyName
ReadOnlySpan<Char>

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Int64

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

Int64使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the Int64 using the default StandardFormat (that is, 'G'); for example, 32767.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(ReadOnlySpan<Char>, Single)

编写指定为只读字符范围的属性名称和 Single 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only character span and a Single value (as a JSON number) as part of a name/value pair of a JSON object.

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

参数

propertyName
ReadOnlySpan<Char>

要进行转码并写为 UTF-8 的 JSON 对象的 UTF-16 编码属性名称。The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Single

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

使用在 Single StandardFormat .net Core 3.0 或更高版本上的默认 (为 "G" ) 来写入。Writes the Single using the default StandardFormat (that is, 'G') on .NET Core 3.0 or later versions. 在任何其他框架上使用 "G9"。Uses 'G9' on any other framework.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于

WriteNumber(ReadOnlySpan<Byte>, UInt64)

重要

此 API 不符合 CLS。

编写指定为字节只读范围的属性名称和 UInt64 值(写为 JSON 数字)作为 JSON 对象的名称/值对的一部分。Writes a property name specified as a read-only span of bytes and a UInt64 value (as a JSON number) as part of a name/value pair of a JSON object.

public:
 void WriteNumber(ReadOnlySpan<System::Byte> utf8PropertyName, System::UInt64 value);
[System.CLSCompliant(false)]
public void WriteNumber (ReadOnlySpan<byte> utf8PropertyName, ulong value);
[<System.CLSCompliant(false)>]
member this.WriteNumber : ReadOnlySpan<byte> * uint64 -> unit
Public Sub WriteNumber (utf8PropertyName As ReadOnlySpan(Of Byte), value As ULong)

参数

utf8PropertyName
ReadOnlySpan<Byte>

要编写的 JSON 对象的 UTF-8 编码属性名称。The UTF-8 encoded property name of the JSON object to be written.

value
UInt64

要以 JSON 数字形式作为名称/值对的一部分编写的值。The value to be written as a JSON number as part of the name/value pair.

属性

例外

指定的属性名称过长。The specified property name is too large.

系统已启用验证,该编写操作将生成无效的 JSON。Validation is enabled, and the write operation would produce invalid JSON.

注解

UInt64使用默认 (,即 StandardFormat "G" ) ,例如32767。Writes the UInt64 using the default StandardFormat (that is, 'G'); for example, 32767.

在写入之前,属性名称经过转义。The property name is escaped before writing.

适用于