你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

ObjectSerializer.Serialize 方法

定义

重载

Serialize(Object, Type, CancellationToken)

将提供的值转换为二进制表示形式,并将其作为 BinaryData 实例返回。

Serialize(Stream, Object, Type, CancellationToken)

将提供的值转换为二进制表示形式,并将其写入 Stream

Serialize(Object, Type, CancellationToken)

Source:
ObjectSerializer.cs

将提供的值转换为二进制表示形式,并将其作为 BinaryData 实例返回。

public virtual BinaryData Serialize (object? value, Type? inputType = default, System.Threading.CancellationToken cancellationToken = default);
abstract member Serialize : obj * Type * System.Threading.CancellationToken -> BinaryData
override this.Serialize : obj * Type * System.Threading.CancellationToken -> BinaryData
Public Overridable Function Serialize (value As Object, Optional inputType As Type = Nothing, Optional cancellationToken As CancellationToken = Nothing) As BinaryData

参数

value
Object

要转换的值。

inputType
Type

序列化 value时要使用的类型。 如果省略,将使用 () 确定 GetType() 类型。

cancellationToken
CancellationToken

在序列化过程中要使用的 CancellationToken

返回

对象的二进制表示形式为 BinaryData

适用于

Serialize(Stream, Object, Type, CancellationToken)

Source:
ObjectSerializer.cs

将提供的值转换为二进制表示形式,并将其写入 Stream

public abstract void Serialize (System.IO.Stream stream, object? value, Type inputType, System.Threading.CancellationToken cancellationToken);
abstract member Serialize : System.IO.Stream * obj * Type * System.Threading.CancellationToken -> unit
Public MustOverride Sub Serialize (stream As Stream, value As Object, inputType As Type, cancellationToken As CancellationToken)

参数

stream
Stream

要向其中进行写入的 Stream

value
Object

要转换的值。

inputType
Type

要转换的 value 的类型。

cancellationToken
CancellationToken

在序列化过程中要使用的 CancellationToken

适用于