Export (0) Print
Expand All

MediaTypeFormatter.WriteToStreamAsync Method

Asynchronously writes an object of the specified type.

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

public function WriteToStreamAsync(
	type : Type, 
	value : Object, 
	writeStream : Stream, 
	content : HttpContent, 
	transportContext : TransportContext
) : Task

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: 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.

ExceptionCondition
NotSupportedException

Derived types need to support writing.

This implementation throws a NotSupportedException. Derived types should override this method if the formatter supports reading. An implementation of this method should NOT close writeStream upon completion. The stream will be closed independently when the HttpContent instance is disposed.

Show:
© 2014 Microsoft