<PackageReference Include="System.ClientModel" Version="1.2.0" />

BinaryContent

public abstract class BinaryContent : IDisposable
Represents binary content that can be sent to a cloud service as part of a PipelineRequest.
protected BinaryContent()

public static BinaryContent Create(BinaryData value)

Creates an instance of BinaryContent that contains the bytes held in the provided BinaryData instance.

public static BinaryContent Create<T>(T model, ModelReaderWriterOptions options = null) where T : IPersistableModel<T>

Creates an instance of BinaryContent that contains the bytes resulting from writing the value of the provided IPersistableModel<T>.

public static BinaryContent Create(Stream stream)

Creates an instance of BinaryContent that contains the bytes held in the provided Stream instance.

public abstract void Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public abstract bool TryComputeLength(out long length)

Attempts to compute the length of the underlying body content, if available.

public abstract void WriteTo(Stream stream, CancellationToken cancellationToken = default)

Writes contents of this BinaryContent instance to the provided Stream.

public abstract Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default)

Writes contents of this BinaryContent instance to the provided Stream.