Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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)
public static ObjectContent CreateContent(
	this HttpResponseMessage response,
	Type type,
	Object value,
	MediaTypeHeaderValue mediaType,
	IEnumerable<MediaTypeFormatter> formatters,
	IFormatterSelector formatterSelector
)

Parameters

response
Type: System.Net.Http.HttpResponseMessage
The HttpResponseMessage.
type
Type: System.Type
The type of the value.
value
Type: System.Object
The value for the new ObjectContent
mediaType
Type: System.Net.Http.Headers.MediaTypeHeaderValue
The MediaTypeHeaderValue to set as the response media type.
formatters
Type: System.Collections.Generic.IEnumerable<MediaTypeFormatter>
The collection of MediaTypeFormatter instances to use.
formatterSelector
Type: System.Net.Http.Formatting.IFormatterSelector
The IFormatterSelector to select the MediaTypeFormatter

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).
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.