Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ApiController.Content Method

 

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

NameDescription
System_CAPS_protmethodContent(Of T)(HttpStatusCode, T)

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

System_CAPS_protmethodContent(Of T)(HttpStatusCode, T, MediaTypeFormatter)

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

System_CAPS_protmethodContent(Of T)(HttpStatusCode, T, MediaTypeFormatter, MediaTypeHeaderValue)

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

System_CAPS_protmethodContent(Of T)(HttpStatusCode, T, MediaTypeFormatter, String)

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

Return to top

ApiController.Content(Of T) Method (HttpStatusCode, T)

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

Protected Friend Overridable Function Content(Of T) (
	statusCode As HttpStatusCode,
	value As T
) As NegotiatedContentResult(Of T)

Parameters

statusCode
Type: System.Net.HttpStatusCode

The HTTP status code for the response message.

value
Type: T

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

Return Value

Type: System.Web.Http.Results.NegotiatedContentResult(Of 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(Of T) Method (HttpStatusCode, T, MediaTypeFormatter)

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

Protected Friend Function Content(Of T) (
	statusCode As HttpStatusCode,
	value As T,
	formatter As MediaTypeFormatter
) As FormattedContentResult(Of T)

Parameters

statusCode
Type: System.Net.HttpStatusCode

The HTTP status code for the response message.

value
Type: T

The content value to format in the entity body.

formatter
Type: System.Net.Http.Formatting.MediaTypeFormatter

The formatter to use to format the content.

Return Value

Type: System.Web.Http.Results.FormattedContentResult(Of 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(Of T) Method (HttpStatusCode, T, MediaTypeFormatter, MediaTypeHeaderValue)

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

Protected Friend Overridable Function Content(Of T) (
	statusCode As HttpStatusCode,
	value As T,
	formatter As MediaTypeFormatter,
	mediaType As MediaTypeHeaderValue
) As FormattedContentResult(Of T)

Parameters

statusCode
Type: System.Net.HttpStatusCode

The HTTP status code for the response message.

value
Type: T

The content value to format in the entity body.

formatter
Type: System.Net.Http.Formatting.MediaTypeFormatter

The formatter to use to format the content.

mediaType
Type: System.Net.Http.Headers.MediaTypeHeaderValue

The value for the Content-Type header, or <see langword="null" /> to have the formatter pick a default value.

Return Value

Type: System.Web.Http.Results.FormattedContentResult(Of 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(Of T) Method (HttpStatusCode, T, MediaTypeFormatter, String)

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

Protected Friend Function Content(Of T) (
	statusCode As HttpStatusCode,
	value As T,
	formatter As MediaTypeFormatter,
	mediaType As String
) As FormattedContentResult(Of T)

Parameters

statusCode
Type: System.Net.HttpStatusCode

The HTTP status code for the response message.

value
Type: T

The content value to format in the entity body.

formatter
Type: System.Net.Http.Formatting.MediaTypeFormatter

The formatter to use to format the content.

mediaType
Type: System.String

The value for the Content-Type header.

Return Value

Type: System.Web.Http.Results.FormattedContentResult(Of 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
Show: