<PackageReference Include="Azure.Core" Version="1.48.0" />

ObjectSerializer

public abstract class ObjectSerializer
An abstraction for reading typed objects.
protected ObjectSerializer()

public abstract object Deserialize(Stream stream, Type returnType, CancellationToken cancellationToken)

Read the binary representation into a returnType. The Stream will be read to completion.

public abstract ValueTask<object> DeserializeAsync(Stream stream, Type returnType, CancellationToken cancellationToken)

Read the binary representation into a returnType. The Stream will be read to completion.

public abstract void Serialize(Stream stream, object value, Type inputType, CancellationToken cancellationToken)

Convert the provided value to it's binary representation and write it to Stream.

public virtual BinaryData Serialize(object value, Type inputType = null, CancellationToken cancellationToken = default)

Convert the provided value to it's binary representation and return it as a BinaryData instance.

public abstract ValueTask SerializeAsync(Stream stream, object value, Type inputType, CancellationToken cancellationToken)

Convert the provided value to it's binary representation and write it to Stream.

public virtual ValueTask<BinaryData> SerializeAsync(object value, Type inputType = null, CancellationToken cancellationToken = default)

Convert the provided value to it's binary representation and return it as a BinaryData instance.