HttpResponseMessageExtensions.CreateContent Method (HttpResponseMessage, Type, Object, MediaTypeHeaderValue, IEnumerable<MediaTypeFormatter>, IFormatterSelector)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Creates a new ObjectContent instance associated with the given HttpResponseMessage.

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

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function CreateContent ( _
    response As HttpResponseMessage, _
    type As Type, _
    value As Object, _
    mediaType As MediaTypeHeaderValue, _
    formatters As IEnumerable(Of MediaTypeFormatter), _
    formatterSelector As IFormatterSelector _
) As ObjectContent
public static ObjectContent CreateContent(
    this HttpResponseMessage response,
    Type type,
    Object value,
    MediaTypeHeaderValue mediaType,
    IEnumerable<MediaTypeFormatter> formatters,
    IFormatterSelector formatterSelector
)
[ExtensionAttribute]
public:
static ObjectContent^ CreateContent(
    HttpResponseMessage^ response, 
    Type^ type, 
    Object^ value, 
    MediaTypeHeaderValue^ mediaType, 
    IEnumerable<MediaTypeFormatter^>^ formatters, 
    IFormatterSelector^ formatterSelector
)
static member CreateContent : 
        response:HttpResponseMessage * 
        type:Type * 
        value:Object * 
        mediaType:MediaTypeHeaderValue * 
        formatters:IEnumerable<MediaTypeFormatter> * 
        formatterSelector:IFormatterSelector -> ObjectContent 
public static function CreateContent(
    response : HttpResponseMessage, 
    type : Type, 
    value : Object, 
    mediaType : MediaTypeHeaderValue, 
    formatters : IEnumerable<MediaTypeFormatter>, 
    formatterSelector : IFormatterSelector
) : ObjectContent

Parameters

Return Value

Type: System.Net.Http.ObjectContent

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type HttpResponseMessage. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

.NET Framework Security

See Also

Reference

HttpResponseMessageExtensions Class

CreateContent Overload

System.Net.Http Namespace