DefaultContentNegotiator.Negotiate Method (Type, HttpRequestMessage, IEnumerable<MediaTypeFormatter>)

 

Performs content negotiating by selecting the most appropriate MediaTypeFormatter out of the passed in formatters for the given request that can serialize an object of the given type.

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

public virtual ContentNegotiationResult Negotiate(
	Type type,
	HttpRequestMessage request,
	IEnumerable<MediaTypeFormatter> formatters
)

Parameters

type
Type: System.Type

The type to be serialized.

request
Type: System.Net.Http.HttpRequestMessage

The request.

formatters
Type: System.Collections.Generic.IEnumerable<MediaTypeFormatter>

The set of MediaTypeFormatter objects from which to choose.

Return Value

Type: System.Net.Http.Formatting.ContentNegotiationResult

The result of the negotiation containing the most appropriate MediaTypeFormatter instance, or null if there is no appropriate formatter.

Return to top
Show: