Show / Hide Table of Contents

Class BinaryContent

Represents binary content that can be sent to a cloud service as part of a PipelineRequest.

Inheritance
System.Object
BinaryContent
Namespace: System.Dynamic.ExpandoObject
Assembly: System.ClientModel.dll
Syntax
[System.Runtime.CompilerServices.Nullable(0)]
[System.Runtime.CompilerServices.NullableContext(1)]
public abstract class BinaryContent : IDisposable

Constructors

BinaryContent()

Declaration
protected BinaryContent ();

Methods

Create(BinaryData)

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

Declaration
public static System.ClientModel.BinaryContent Create (BinaryData value);
Parameters
System.BinaryData value

The System.BinaryData containing the bytes this BinaryContent will hold.

Returns
BinaryContent

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

Create(Stream)

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

Declaration
public static System.ClientModel.BinaryContent Create (System.IO.Stream stream);
Parameters
System.IO.Stream stream

The System.IO.Stream containing the bytes this BinaryContent will hold.

Returns
BinaryContent

An an instance of BinaryContent that contains the bytes held in the provided System.IO.Stream instance.

Create<T>(T, ModelReaderWriterOptions)

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

Declaration
public static System.ClientModel.BinaryContent Create<T> (T model, System.ClientModel.Primitives.ModelReaderWriterOptions options = null) where T : System.ClientModel.Primitives.IPersistableModel<T>;
Parameters
model

The IPersistableModel<T> to write.

ModelReaderWriterOptions options

The ModelReaderWriterOptions, if any, that indicates what format the model will be written in.

Returns
BinaryContent

An instance of BinaryContent that wraps a IPersistableModel<T>.

Type Parameters
T

Dispose()

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

Declaration
public abstract void Dispose ();

TryComputeLength(Int64)

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

Declaration
public abstract bool TryComputeLength (out long length);
Parameters
System.Int64 length

The length of the underlying data.

Returns
System.Boolean

WriteTo(Stream, CancellationToken)

Writes contents of this BinaryContent instance to the provided System.IO.Stream.

Declaration
public abstract void WriteTo (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.IO.Stream stream

The stream to write the binary content to.

System.Threading.CancellationToken cancellationToken

To System.Threading.CancellationToken to use for the write operation.

WriteToAsync(Stream, CancellationToken)

Writes contents of this BinaryContent instance to the provided System.IO.Stream.

Declaration
public abstract System.Threading.Tasks.Task WriteToAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = null);
Parameters
System.IO.Stream stream

The stream to write the binary content to.

System.Threading.CancellationToken cancellationToken

To System.Threading.CancellationToken to use for the write operation.

Returns
System.Threading.Tasks.Task

Back to top Azure SDK for .NET