Freigeben über


HttpContentExtensions.ReadAsAsync Method

 

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

Overload List

Name Description
System_CAPS_pubmethodSystem_CAPS_static ReadAsAsync(HttpContent, Type)

Returns a Task that will yield an object of the specified type from the content instance.

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

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

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

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

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

System_CAPS_pubmethodSystem_CAPS_static ReadAsAsync<T>(HttpContent)

Returns a Task that will yield an object of the specified type <typeparamref name="T" /> from the content instance.

System_CAPS_pubmethodSystem_CAPS_static ReadAsAsync<T>(HttpContent, CancellationToken)

Returns a Task that will yield an object of the specified type from the content instance.

System_CAPS_pubmethodSystem_CAPS_static ReadAsAsync<T>(HttpContent, IEnumerable<MediaTypeFormatter>)

Returns a Task that will yield an object of the specified type <typeparamref name="T" /> from the content instance.

System_CAPS_pubmethodSystem_CAPS_static ReadAsAsync<T>(HttpContent, IEnumerable<MediaTypeFormatter>, CancellationToken)

Returns a Task that will yield an object of the specified type from the content instance.

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

System_CAPS_pubmethodSystem_CAPS_static 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

  • type
    Type: System.Type

    The 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

  • type
    Type: System.Type

    The type of the object to read.

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

  • type
    Type: System.Type

    The type of the object to read.

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

  • type
    Type: System.Type

    The type of the object to read.

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

  • type
    Type: System.Type

    The type of the object to read.

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

  • type
    Type: System.Type

    The type of the object to read.

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

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

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

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

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

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

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