Bagikan melalui


ApiController.Content Method

 

Namespace:   System.Web.Http
Assembly:  System.Web.Http (in System.Web.Http.dll)

Overload List

Name Description
System_CAPS_protmethod Content<T>(HttpStatusCode, T)

Creates a <see cref="T:System.Web.Http.NegotiatedContentResult`1" /> with the specified values.

System_CAPS_protmethod Content<T>(HttpStatusCode, T, MediaTypeFormatter)

Creates a <see cref="T:System.Web.Http.FormattedContentResult`1" /> with the specified values.

System_CAPS_protmethod Content<T>(HttpStatusCode, T, MediaTypeFormatter, MediaTypeHeaderValue)

Creates a <see cref="T:System.Web.Http.FormattedContentResult`1" /> with the specified values.

System_CAPS_protmethod Content<T>(HttpStatusCode, T, MediaTypeFormatter, String)

Creates a <see cref="T:System.Web.Http.FormattedContentResult`1" /> with the specified values.

See Also

ApiController Class
System.Web.Http Namespace

Return to top

ApiController.Content<T> Method (HttpStatusCode, T)

Creates a <see cref="T:System.Web.Http.NegotiatedContentResult`1" /> with the specified values.

Syntax

protected internal virtual NegotiatedContentResult<T> Content<T>(
    HttpStatusCode statusCode,
    T value
)
public protected:
generic<typename T>
virtual NegotiatedContentResult<T>^ Content(
    HttpStatusCode statusCode,
    T value
)
abstract Content<'T> : 
        statusCode:HttpStatusCode *
        value:'T -> NegotiatedContentResult<'T>
override Content<'T> : 
        statusCode:HttpStatusCode *
        value:'T -> NegotiatedContentResult<'T>
Protected Friend Overridable Function Content(Of T) (
    statusCode As HttpStatusCode,
    value As T
) As NegotiatedContentResult(Of T)

Parameters

  • value
    Type: T

    The content value to negotiate and format in the entity body.

Return Value

Type: System.Web.Http.Results.NegotiatedContentResult<T>

A <see cref="T:System.Web.Http.NegotiatedContentResult`1" /> with the specified values.

Type Parameters

  • T
    The type of content in the entity body.

Return to top

ApiController.Content<T> Method (HttpStatusCode, T, MediaTypeFormatter)

Creates a <see cref="T:System.Web.Http.FormattedContentResult`1" /> with the specified values.

Syntax

protected internal FormattedContentResult<T> Content<T>(
    HttpStatusCode statusCode,
    T value,
    MediaTypeFormatter formatter
)
public protected:
generic<typename T>
FormattedContentResult<T>^ Content(
    HttpStatusCode statusCode,
    T value,
    MediaTypeFormatter^ formatter
)
member Content<'T> : 
        statusCode:HttpStatusCode *
        value:'T *
        formatter:MediaTypeFormatter -> FormattedContentResult<'T>
Protected Friend Function Content(Of T) (
    statusCode As HttpStatusCode,
    value As T,
    formatter As MediaTypeFormatter
) As FormattedContentResult(Of T)

Parameters

  • value
    Type: T

    The content value to format in the entity body.

Return Value

Type: System.Web.Http.Results.FormattedContentResult<T>

A <see cref="T:System.Web.Http.FormattedContentResult`1" /> with the specified values.

Type Parameters

  • T
    The type of content in the entity body.

Return to top

ApiController.Content<T> Method (HttpStatusCode, T, MediaTypeFormatter, MediaTypeHeaderValue)

Creates a <see cref="T:System.Web.Http.FormattedContentResult`1" /> with the specified values.

Syntax

protected internal virtual FormattedContentResult<T> Content<T>(
    HttpStatusCode statusCode,
    T value,
    MediaTypeFormatter formatter,
    MediaTypeHeaderValue mediaType
)
public protected:
generic<typename T>
virtual FormattedContentResult<T>^ Content(
    HttpStatusCode statusCode,
    T value,
    MediaTypeFormatter^ formatter,
    MediaTypeHeaderValue^ mediaType
)
abstract Content<'T> : 
        statusCode:HttpStatusCode *
        value:'T *
        formatter:MediaTypeFormatter *
        mediaType:MediaTypeHeaderValue -> FormattedContentResult<'T>
override Content<'T> : 
        statusCode:HttpStatusCode *
        value:'T *
        formatter:MediaTypeFormatter *
        mediaType:MediaTypeHeaderValue -> FormattedContentResult<'T>
Protected Friend Overridable Function Content(Of T) (
    statusCode As HttpStatusCode,
    value As T,
    formatter As MediaTypeFormatter,
    mediaType As MediaTypeHeaderValue
) As FormattedContentResult(Of T)

Parameters

  • value
    Type: T

    The content value to format in the entity body.

Return Value

Type: System.Web.Http.Results.FormattedContentResult<T>

A <see cref="T:System.Web.Http.FormattedContentResult`1" /> with the specified values.

Type Parameters

  • T
    The type of content in the entity body.

Return to top

ApiController.Content<T> Method (HttpStatusCode, T, MediaTypeFormatter, String)

Creates a <see cref="T:System.Web.Http.FormattedContentResult`1" /> with the specified values.

Syntax

protected internal FormattedContentResult<T> Content<T>(
    HttpStatusCode statusCode,
    T value,
    MediaTypeFormatter formatter,
    string mediaType
)
public protected:
generic<typename T>
FormattedContentResult<T>^ Content(
    HttpStatusCode statusCode,
    T value,
    MediaTypeFormatter^ formatter,
    String^ mediaType
)
member Content<'T> : 
        statusCode:HttpStatusCode *
        value:'T *
        formatter:MediaTypeFormatter *
        mediaType:string -> FormattedContentResult<'T>
Protected Friend Function Content(Of T) (
    statusCode As HttpStatusCode,
    value As T,
    formatter As MediaTypeFormatter,
    mediaType As String
) As FormattedContentResult(Of T)

Parameters

  • value
    Type: T

    The content value to format in the entity body.

  • mediaType
    Type: System.String

    The value for the Content-Type header.

Return Value

Type: System.Web.Http.Results.FormattedContentResult<T>

A <see cref="T:System.Web.Http.FormattedContentResult`1" /> with the specified values.

Type Parameters

  • T
    The type of content in the entity body.

Return to top