MediaTypeFormatter.ReadFromStreamAsync Method
Namespace: System.Net.Http.Formatting
Assembly: System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)
Overload List
Name | Description | |
---|---|---|
ReadFromStreamAsync(Type, Stream, HttpContent, IFormatterLogger) | Asynchronously deserializes an object of the specified type. |
|
ReadFromStreamAsync(Type, Stream, HttpContent, IFormatterLogger, CancellationToken) | Asynchronously deserializes an object of the specified type. |
See Also
MediaTypeFormatter Class
System.Net.Http.Formatting Namespace
Return to top
MediaTypeFormatter.ReadFromStreamAsync Method (Type, Stream, HttpContent, IFormatterLogger)
Asynchronously deserializes an object of the specified type.
Syntax
public virtual Task<object> ReadFromStreamAsync(
Type type,
Stream readStream,
HttpContent content,
IFormatterLogger formatterLogger
)
public:
virtual Task<Object^>^ ReadFromStreamAsync(
Type^ type,
Stream^ readStream,
HttpContent^ content,
IFormatterLogger^ formatterLogger
)
abstract ReadFromStreamAsync :
type:Type *
readStream:Stream *
content:HttpContent *
formatterLogger:IFormatterLogger -> Task<Object>
override ReadFromStreamAsync :
type:Type *
readStream:Stream *
content:HttpContent *
formatterLogger:IFormatterLogger -> Task<Object>
Public Overridable Function ReadFromStreamAsync (
type As Type,
readStream As Stream,
content As HttpContent,
formatterLogger As IFormatterLogger
) As Task(Of Object)
Parameters
type
Type: System.TypeThe type of the object to deserialize.
readStream
Type: System.IO.StreamThe Stream to read.
content
Type: System.Net.Http.HttpContentThe HttpContent, if available. It may be null.
formatterLogger
Type: System.Net.Http.Formatting.IFormatterLoggerThe 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.
Exceptions
Exception | Condition |
---|---|
NotSupportedException | Derived types need to support reading. |
Return to top
MediaTypeFormatter.ReadFromStreamAsync Method (Type, Stream, HttpContent, IFormatterLogger, CancellationToken)
Asynchronously deserializes an object of the specified type.
Syntax
public virtual Task<object> ReadFromStreamAsync(
Type type,
Stream readStream,
HttpContent content,
IFormatterLogger formatterLogger,
CancellationToken cancellationToken
)
public:
virtual Task<Object^>^ ReadFromStreamAsync(
Type^ type,
Stream^ readStream,
HttpContent^ content,
IFormatterLogger^ formatterLogger,
CancellationToken cancellationToken
)
abstract ReadFromStreamAsync :
type:Type *
readStream:Stream *
content:HttpContent *
formatterLogger:IFormatterLogger *
cancellationToken:CancellationToken -> Task<Object>
override ReadFromStreamAsync :
type:Type *
readStream:Stream *
content:HttpContent *
formatterLogger:IFormatterLogger *
cancellationToken:CancellationToken -> Task<Object>
Public Overridable Function ReadFromStreamAsync (
type As Type,
readStream As Stream,
content As HttpContent,
formatterLogger As IFormatterLogger,
cancellationToken As CancellationToken
) As Task(Of Object)
Parameters
type
Type: System.TypeThe type of the object to deserialize.
readStream
Type: System.IO.StreamThe Stream to read.
content
Type: System.Net.Http.HttpContentThe HttpContent, if available. It may be null.
formatterLogger
Type: System.Net.Http.Formatting.IFormatterLoggerThe IFormatterLogger to log events to.
cancellationToken
Type: System.Threading.CancellationTokenThe token to cancel the operation.
Return Value
Type: System.Threading.Tasks.Task<Object>
A Task whose result will be an object of the given type.
Return to top