HttpContentExtensions.ReadAsAsync Method
Namespace: System.Net.Http
Assembly: System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)
Overload List
Name | Description | |
---|---|---|
ReadAsAsync(HttpContent, Type) | Returns a Task that will yield an object of the specified type from the content instance. |
|
ReadAsAsync(HttpContent, Type, CancellationToken) | Returns a Task that will yield an object of the specified type from the content instance using one of the provided formatters to deserialize the content. |
|
ReadAsAsync(HttpContent, Type, IEnumerable<MediaTypeFormatter>) | Returns a Task that will yield an object of the specified type from the content instance using one of the provided formatters to deserialize the content. |
|
ReadAsAsync(HttpContent, Type, IEnumerable<MediaTypeFormatter>, CancellationToken) | Returns a Task that will yield an object of the specified type from the content instance using one of the provided formatters to deserialize the content. |
|
ReadAsAsync(HttpContent, Type, IEnumerable<MediaTypeFormatter>, IFormatterLogger) | Returns a Task that will yield an object of the specified type from the content instance using one of the provided formatters to deserialize the content. |
|
ReadAsAsync(HttpContent, Type, IEnumerable<MediaTypeFormatter>, IFormatterLogger, CancellationToken) | Returns a Task that will yield an object of the specified type from the content instance using one of the provided formatters to deserialize the content. |
|
ReadAsAsync<T>(HttpContent) | Returns a Task that will yield an object of the specified type <typeparamref name="T" /> from the content instance. |
|
ReadAsAsync<T>(HttpContent, CancellationToken) | Returns a Task that will yield an object of the specified type from the content instance. |
|
ReadAsAsync<T>(HttpContent, IEnumerable<MediaTypeFormatter>) | Returns a Task that will yield an object of the specified type <typeparamref name="T" /> from the content instance. |
|
ReadAsAsync<T>(HttpContent, IEnumerable<MediaTypeFormatter>, CancellationToken) | Returns a Task that will yield an object of the specified type from the content instance. |
|
ReadAsAsync<T>(HttpContent, IEnumerable<MediaTypeFormatter>, IFormatterLogger) | Returns a Task that will yield an object of the specified type <typeparamref name="T" /> from the content instance. |
|
ReadAsAsync<T>(HttpContent, IEnumerable<MediaTypeFormatter>, IFormatterLogger, CancellationToken) | Returns a Task that will yield an object of the specified type from the content instance. |
See Also
HttpContentExtensions Class
System.Net.Http Namespace
Return to top
HttpContentExtensions.ReadAsAsync Method (HttpContent, Type)
Returns a Task that will yield an object of the specified type from the content instance.
Syntax
public static Task<object> ReadAsAsync(
this HttpContent content,
Type type
)
public:
[ExtensionAttribute]
static Task<Object^>^ ReadAsAsync(
HttpContent^ content,
Type^ type
)
static member ReadAsAsync :
content:HttpContent *
type:Type -> Task<Object>
<ExtensionAttribute>
Public Shared Function ReadAsAsync (
content As HttpContent,
type As Type
) As Task(Of Object)
Parameters
content
Type: System.Net.Http.HttpContentThe HttpContent instance from which to read.
type
Type: System.TypeThe type of the object to read.
Return Value
Type: System.Threading.Tasks.Task<Object>
A Task that will yield an object instance of the specified type.
Return to top
HttpContentExtensions.ReadAsAsync Method (HttpContent, Type, CancellationToken)
Returns a Task that will yield an object of the specified type from the content instance using one of the provided formatters to deserialize the content.
Syntax
public static Task<object> ReadAsAsync(
this HttpContent content,
Type type,
CancellationToken cancellationToken
)
public:
[ExtensionAttribute]
static Task<Object^>^ ReadAsAsync(
HttpContent^ content,
Type^ type,
CancellationToken cancellationToken
)
static member ReadAsAsync :
content:HttpContent *
type:Type *
cancellationToken:CancellationToken -> Task<Object>
<ExtensionAttribute>
Public Shared Function ReadAsAsync (
content As HttpContent,
type As Type,
cancellationToken As CancellationToken
) As Task(Of Object)
Parameters
content
Type: System.Net.Http.HttpContentThe HttpContent instance from which to read.
type
Type: System.TypeThe type of the object to read.
cancellationToken
Type: System.Threading.CancellationTokenThe token to cancel the operation.
Return Value
Type: System.Threading.Tasks.Task<Object>
An object instance of the specified type.
Return to top
HttpContentExtensions.ReadAsAsync Method (HttpContent, Type, IEnumerable<MediaTypeFormatter>)
Returns a Task that will yield an object of the specified type from the content instance using one of the provided formatters to deserialize the content.
Syntax
public static Task<object> ReadAsAsync(
this HttpContent content,
Type type,
IEnumerable<MediaTypeFormatter> formatters
)
public:
[ExtensionAttribute]
static Task<Object^>^ ReadAsAsync(
HttpContent^ content,
Type^ type,
IEnumerable<MediaTypeFormatter^>^ formatters
)
static member ReadAsAsync :
content:HttpContent *
type:Type *
formatters:IEnumerable<MediaTypeFormatter> -> Task<Object>
<ExtensionAttribute>
Public Shared Function ReadAsAsync (
content As HttpContent,
type As Type,
formatters As IEnumerable(Of MediaTypeFormatter)
) As Task(Of Object)
Parameters
content
Type: System.Net.Http.HttpContentThe HttpContent instance from which to read.
type
Type: System.TypeThe type of the object to read.
formatters
Type: System.Collections.Generic.IEnumerable<MediaTypeFormatter>The collection of MediaTypeFormatter instances to use.
Return Value
Type: System.Threading.Tasks.Task<Object>
An object instance of the specified type.
Return to top
HttpContentExtensions.ReadAsAsync Method (HttpContent, Type, IEnumerable<MediaTypeFormatter>, CancellationToken)
Returns a Task that will yield an object of the specified type from the content instance using one of the provided formatters to deserialize the content.
Syntax
public static Task<object> ReadAsAsync(
this HttpContent content,
Type type,
IEnumerable<MediaTypeFormatter> formatters,
CancellationToken cancellationToken
)
public:
[ExtensionAttribute]
static Task<Object^>^ ReadAsAsync(
HttpContent^ content,
Type^ type,
IEnumerable<MediaTypeFormatter^>^ formatters,
CancellationToken cancellationToken
)
static member ReadAsAsync :
content:HttpContent *
type:Type *
formatters:IEnumerable<MediaTypeFormatter> *
cancellationToken:CancellationToken -> Task<Object>
<ExtensionAttribute>
Public Shared Function ReadAsAsync (
content As HttpContent,
type As Type,
formatters As IEnumerable(Of MediaTypeFormatter),
cancellationToken As CancellationToken
) As Task(Of Object)
Parameters
content
Type: System.Net.Http.HttpContentThe HttpContent instance from which to read.
type
Type: System.TypeThe type of the object to read.
formatters
Type: System.Collections.Generic.IEnumerable<MediaTypeFormatter>The collection of MediaTypeFormatter instances to use.
cancellationToken
Type: System.Threading.CancellationTokenThe token to cancel the operation.
Return Value
Type: System.Threading.Tasks.Task<Object>
An object instance of the specified type.
Return to top
HttpContentExtensions.ReadAsAsync Method (HttpContent, Type, IEnumerable<MediaTypeFormatter>, IFormatterLogger)
Returns a Task that will yield an object of the specified type from the content instance using one of the provided formatters to deserialize the content.
Syntax
public static Task<object> ReadAsAsync(
this HttpContent content,
Type type,
IEnumerable<MediaTypeFormatter> formatters,
IFormatterLogger formatterLogger
)
public:
[ExtensionAttribute]
static Task<Object^>^ ReadAsAsync(
HttpContent^ content,
Type^ type,
IEnumerable<MediaTypeFormatter^>^ formatters,
IFormatterLogger^ formatterLogger
)
static member ReadAsAsync :
content:HttpContent *
type:Type *
formatters:IEnumerable<MediaTypeFormatter> *
formatterLogger:IFormatterLogger -> Task<Object>
<ExtensionAttribute>
Public Shared Function ReadAsAsync (
content As HttpContent,
type As Type,
formatters As IEnumerable(Of MediaTypeFormatter),
formatterLogger As IFormatterLogger
) As Task(Of Object)
Parameters
content
Type: System.Net.Http.HttpContentThe HttpContent instance from which to read.
type
Type: System.TypeThe type of the object to read.
formatters
Type: System.Collections.Generic.IEnumerable<MediaTypeFormatter>The collection of MediaTypeFormatter instances to use.
formatterLogger
Type: System.Net.Http.Formatting.IFormatterLoggerThe IFormatterLogger to log events to.
Return Value
Type: System.Threading.Tasks.Task<Object>
An object instance of the specified type.
Return to top
HttpContentExtensions.ReadAsAsync Method (HttpContent, Type, IEnumerable<MediaTypeFormatter>, IFormatterLogger, CancellationToken)
Returns a Task that will yield an object of the specified type from the content instance using one of the provided formatters to deserialize the content.
Syntax
public static Task<object> ReadAsAsync(
this HttpContent content,
Type type,
IEnumerable<MediaTypeFormatter> formatters,
IFormatterLogger formatterLogger,
CancellationToken cancellationToken
)
public:
[ExtensionAttribute]
static Task<Object^>^ ReadAsAsync(
HttpContent^ content,
Type^ type,
IEnumerable<MediaTypeFormatter^>^ formatters,
IFormatterLogger^ formatterLogger,
CancellationToken cancellationToken
)
static member ReadAsAsync :
content:HttpContent *
type:Type *
formatters:IEnumerable<MediaTypeFormatter> *
formatterLogger:IFormatterLogger *
cancellationToken:CancellationToken -> Task<Object>
<ExtensionAttribute>
Public Shared Function ReadAsAsync (
content As HttpContent,
type As Type,
formatters As IEnumerable(Of MediaTypeFormatter),
formatterLogger As IFormatterLogger,
cancellationToken As CancellationToken
) As Task(Of Object)
Parameters
content
Type: System.Net.Http.HttpContentThe HttpContent instance from which to read.
type
Type: System.TypeThe type of the object to read.
formatters
Type: System.Collections.Generic.IEnumerable<MediaTypeFormatter>The collection of MediaTypeFormatter instances to use.
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>
An object instance of the specified type.
Return to top
HttpContentExtensions.ReadAsAsync<T> Method (HttpContent)
Returns a Task that will yield an object of the specified type <typeparamref name="T" /> from the content instance.
Syntax
public static Task<T> ReadAsAsync<T>(
this HttpContent content
)
public:
generic<typename T>
[ExtensionAttribute]
static Task<T>^ ReadAsAsync(
HttpContent^ content
)
static member ReadAsAsync<'T> :
content:HttpContent -> Task<'T>
<ExtensionAttribute>
Public Shared Function ReadAsAsync(Of T) (
content As HttpContent
) As Task(Of T)
Parameters
content
Type: System.Net.Http.HttpContentThe HttpContent instance from which to read.
Return Value
Type: System.Threading.Tasks.Task<T>
An object instance of the specified type.
Type Parameters
- T
The type of the object to read.
Return to top
HttpContentExtensions.ReadAsAsync<T> Method (HttpContent, CancellationToken)
Returns a Task that will yield an object of the specified type from the content instance.
Syntax
public static Task<T> ReadAsAsync<T>(
this HttpContent content,
CancellationToken cancellationToken
)
public:
generic<typename T>
[ExtensionAttribute]
static Task<T>^ ReadAsAsync(
HttpContent^ content,
CancellationToken cancellationToken
)
static member ReadAsAsync<'T> :
content:HttpContent *
cancellationToken:CancellationToken -> Task<'T>
<ExtensionAttribute>
Public Shared Function ReadAsAsync(Of T) (
content As HttpContent,
cancellationToken As CancellationToken
) As Task(Of T)
Parameters
content
Type: System.Net.Http.HttpContentThe HttpContent instance from which to read.
cancellationToken
Type: System.Threading.CancellationTokenThe token to cancel the operation.
Return Value
Type: System.Threading.Tasks.Task<T>
An object instance of the specified type.
Type Parameters
- T
The type of the object to read.
Return to top
HttpContentExtensions.ReadAsAsync<T> Method (HttpContent, IEnumerable<MediaTypeFormatter>)
Returns a Task that will yield an object of the specified type <typeparamref name="T" /> from the content instance.
Syntax
public static Task<T> ReadAsAsync<T>(
this HttpContent content,
IEnumerable<MediaTypeFormatter> formatters
)
public:
generic<typename T>
[ExtensionAttribute]
static Task<T>^ ReadAsAsync(
HttpContent^ content,
IEnumerable<MediaTypeFormatter^>^ formatters
)
static member ReadAsAsync<'T> :
content:HttpContent *
formatters:IEnumerable<MediaTypeFormatter> -> Task<'T>
<ExtensionAttribute>
Public Shared Function ReadAsAsync(Of T) (
content As HttpContent,
formatters As IEnumerable(Of MediaTypeFormatter)
) As Task(Of T)
Parameters
content
Type: System.Net.Http.HttpContentThe HttpContent instance from which to read.
formatters
Type: System.Collections.Generic.IEnumerable<MediaTypeFormatter>The collection of MediaTyepFormatter instances to use.
Return Value
Type: System.Threading.Tasks.Task<T>
An object instance of the specified type.
Type Parameters
- T
The type of the object to read.
Return to top
HttpContentExtensions.ReadAsAsync<T> Method (HttpContent, IEnumerable<MediaTypeFormatter>, CancellationToken)
Returns a Task that will yield an object of the specified type from the content instance.
Syntax
public static Task<T> ReadAsAsync<T>(
this HttpContent content,
IEnumerable<MediaTypeFormatter> formatters,
CancellationToken cancellationToken
)
public:
generic<typename T>
[ExtensionAttribute]
static Task<T>^ ReadAsAsync(
HttpContent^ content,
IEnumerable<MediaTypeFormatter^>^ formatters,
CancellationToken cancellationToken
)
static member ReadAsAsync<'T> :
content:HttpContent *
formatters:IEnumerable<MediaTypeFormatter> *
cancellationToken:CancellationToken -> Task<'T>
<ExtensionAttribute>
Public Shared Function ReadAsAsync(Of T) (
content As HttpContent,
formatters As IEnumerable(Of MediaTypeFormatter),
cancellationToken As CancellationToken
) As Task(Of T)
Parameters
content
Type: System.Net.Http.HttpContentThe HttpContent instance from which to read.
formatters
Type: System.Collections.Generic.IEnumerable<MediaTypeFormatter>The collection of MediaTypeFormatter instances to use.
cancellationToken
Type: System.Threading.CancellationTokenThe token to cancel the operation.
Return Value
Type: System.Threading.Tasks.Task<T>
An object instance of the specified type.
Type Parameters
- T
The type of the object to read.
Return to top
HttpContentExtensions.ReadAsAsync<T> Method (HttpContent, IEnumerable<MediaTypeFormatter>, IFormatterLogger)
Returns a Task that will yield an object of the specified type <typeparamref name="T" /> from the content instance.
Syntax
public static Task<T> ReadAsAsync<T>(
this HttpContent content,
IEnumerable<MediaTypeFormatter> formatters,
IFormatterLogger formatterLogger
)
public:
generic<typename T>
[ExtensionAttribute]
static Task<T>^ ReadAsAsync(
HttpContent^ content,
IEnumerable<MediaTypeFormatter^>^ formatters,
IFormatterLogger^ formatterLogger
)
static member ReadAsAsync<'T> :
content:HttpContent *
formatters:IEnumerable<MediaTypeFormatter> *
formatterLogger:IFormatterLogger -> Task<'T>
<ExtensionAttribute>
Public Shared Function ReadAsAsync(Of T) (
content As HttpContent,
formatters As IEnumerable(Of MediaTypeFormatter),
formatterLogger As IFormatterLogger
) As Task(Of T)
Parameters
content
Type: System.Net.Http.HttpContentThe HttpContent instance from which to read.
formatters
Type: System.Collections.Generic.IEnumerable<MediaTypeFormatter>The collection of MediaTypeFormatter instances to use.
formatterLogger
Type: System.Net.Http.Formatting.IFormatterLoggerThe IFormatterLogger to log events to.
Return Value
Type: System.Threading.Tasks.Task<T>
An object instance of the specified type.
Type Parameters
- T
The type of the object to read.
Return to top
HttpContentExtensions.ReadAsAsync<T> Method (HttpContent, IEnumerable<MediaTypeFormatter>, IFormatterLogger, CancellationToken)
Returns a Task that will yield an object of the specified type from the content instance.
Syntax
public static Task<T> ReadAsAsync<T>(
this HttpContent content,
IEnumerable<MediaTypeFormatter> formatters,
IFormatterLogger formatterLogger,
CancellationToken cancellationToken
)
public:
generic<typename T>
[ExtensionAttribute]
static Task<T>^ ReadAsAsync(
HttpContent^ content,
IEnumerable<MediaTypeFormatter^>^ formatters,
IFormatterLogger^ formatterLogger,
CancellationToken cancellationToken
)
static member ReadAsAsync<'T> :
content:HttpContent *
formatters:IEnumerable<MediaTypeFormatter> *
formatterLogger:IFormatterLogger *
cancellationToken:CancellationToken -> Task<'T>
<ExtensionAttribute>
Public Shared Function ReadAsAsync(Of T) (
content As HttpContent,
formatters As IEnumerable(Of MediaTypeFormatter),
formatterLogger As IFormatterLogger,
cancellationToken As CancellationToken
) As Task(Of T)
Parameters
content
Type: System.Net.Http.HttpContentThe HttpContent instance from which to read.
formatters
Type: System.Collections.Generic.IEnumerable<MediaTypeFormatter>The collection of MediaTypeFormatter instances to use.
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<T>
An object instance of the specified type.
Type Parameters
- T
The type of the object to read.
Return to top