MediaTypeFormatter.ReadFromStreamAsync Method (Type, Stream, HttpContent, IFormatterLogger)

Asynchronously deserializes an object of the specified type.

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

public virtual Task<Object> ReadFromStreamAsync(
	Type type,
	Stream readStream,
	HttpContent content,
	IFormatterLogger formatterLogger
)

Parameters

type
Type: System.Type
The type of the object to deserialize.
readStream
Type: System.IO.Stream
The Stream to read.
content
Type: HttpContent
The HttpContent, if available. It may be null.
formatterLogger
Type: System.Net.Http.Formatting.IFormatterLogger
The IFormatterLogger to log events to.

Return Value

Type: System.Threading.Tasks.Task<Object>
A Task whose result will be an object of the given type.

ExceptionCondition
NotSupportedException

Derived types need to support reading.

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

Show: