Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MediaTypeFormatter.WriteToStreamAsync Method

 

Namespace:   System.Net.Http.Formatting
Assembly:  System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)

Return to top

MediaTypeFormatter.WriteToStreamAsync Method (Type, Object, Stream, HttpContent, TransportContext)

Asynchronously writes an object of the specified type.

public virtual Task WriteToStreamAsync(
	Type type,
	object value,
	Stream writeStream,
	HttpContent content,
	TransportContext transportContext
)

Parameters

type
Type: System.Type

The type of the object to write.

value
Type: System.Object

The object value to write. It may be null.

writeStream
Type: System.IO.Stream

The Stream to which to write.

content
Type: System.Net.Http.HttpContent

The HttpContent if available. It may be null.

transportContext
Type: System.Net.TransportContext

The TransportContext if available. It may be null.

Return Value

Type: System.Threading.Tasks.Task

A Task that will perform the write.

Exception Condition
NotSupportedException

Derived types need to support writing.

Return to top

MediaTypeFormatter.WriteToStreamAsync Method (Type, Object, Stream, HttpContent, TransportContext, CancellationToken)

Asynchronously writes an object of the specified type.

public virtual Task WriteToStreamAsync(
	Type type,
	object value,
	Stream writeStream,
	HttpContent content,
	TransportContext transportContext,
	CancellationToken cancellationToken
)

Parameters

type
Type: System.Type

The type of the object to write.

value
Type: System.Object

The object value to write. It may be null.

writeStream
Type: System.IO.Stream

The Stream to which to write.

content
Type: System.Net.Http.HttpContent

The HttpContent if available. It may be null.

transportContext
Type: System.Net.TransportContext

The TransportContext if available. It may be null.

cancellationToken
Type: System.Threading.CancellationToken

The token to cancel the operation.

Return Value

Type: System.Threading.Tasks.Task

A Task that will perform the write.

Exception Condition
NotSupportedException

Derived types need to support writing.

Return to top
Show: