Share via


DefaultContentNegotiator.Negotiate Method

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)

Syntax

'Declaration
Public Overridable Function Negotiate ( _
    type As Type, _
    request As HttpRequestMessage, _
    formatters As IEnumerable(Of MediaTypeFormatter) _
) As ContentNegotiationResult
'Usage
Dim instance As DefaultContentNegotiator 
Dim type As Type 
Dim request As HttpRequestMessage 
Dim formatters As IEnumerable(Of MediaTypeFormatter)
Dim returnValue As ContentNegotiationResult 

returnValue = instance.Negotiate(type, _
    request, formatters)
public virtual ContentNegotiationResult Negotiate(
    Type type,
    HttpRequestMessage request,
    IEnumerable<MediaTypeFormatter> formatters
)
public:
virtual ContentNegotiationResult^ Negotiate(
    Type^ type, 
    HttpRequestMessage^ request, 
    IEnumerable<MediaTypeFormatter^>^ formatters
)
abstract Negotiate : 
        type:Type * 
        request:HttpRequestMessage * 
        formatters:IEnumerable<MediaTypeFormatter> -> ContentNegotiationResult  
override Negotiate : 
        type:Type * 
        request:HttpRequestMessage * 
        formatters:IEnumerable<MediaTypeFormatter> -> ContentNegotiationResult
public function Negotiate(
    type : Type, 
    request : HttpRequestMessage, 
    formatters : IEnumerable<MediaTypeFormatter>
) : ContentNegotiationResult

Parameters

  • request
    Type: HttpRequestMessage

    The request.

Return Value

Type: System.Net.Http.Formatting.ContentNegotiationResult
The result of the negotiation containing the most appropriate MediaTypeFormatter instance, or null reference (Nothing in Visual Basic) if there is no appropriate formatter.

Implements

IContentNegotiator.Negotiate(Type, HttpRequestMessage, IEnumerable<MediaTypeFormatter>)

See Also

Reference

DefaultContentNegotiator Class

System.Net.Http.Formatting Namespace