Compartilhar via


DefaultContentNegotiator.ComputeFormatterMatches Method

Determines how well each formatter matches an HTTP request.

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

Syntax

'Declaration
Protected Overridable Function ComputeFormatterMatches ( _
    type As Type, _
    request As HttpRequestMessage, _
    formatters As IEnumerable(Of MediaTypeFormatter) _
) As Collection(Of MediaTypeFormatterMatch)
'Usage
Dim type As Type 
Dim request As HttpRequestMessage 
Dim formatters As IEnumerable(Of MediaTypeFormatter)
Dim returnValue As Collection(Of MediaTypeFormatterMatch)

returnValue = Me.ComputeFormatterMatches(type, _
    request, formatters)
protected virtual Collection<MediaTypeFormatterMatch> ComputeFormatterMatches(
    Type type,
    HttpRequestMessage request,
    IEnumerable<MediaTypeFormatter> formatters
)
protected:
virtual Collection<MediaTypeFormatterMatch^>^ ComputeFormatterMatches(
    Type^ type, 
    HttpRequestMessage^ request, 
    IEnumerable<MediaTypeFormatter^>^ formatters
)
abstract ComputeFormatterMatches : 
        type:Type * 
        request:HttpRequestMessage * 
        formatters:IEnumerable<MediaTypeFormatter> -> Collection<MediaTypeFormatterMatch> 
override ComputeFormatterMatches : 
        type:Type * 
        request:HttpRequestMessage * 
        formatters:IEnumerable<MediaTypeFormatter> -> Collection<MediaTypeFormatterMatch> 
protected function ComputeFormatterMatches(
    type : Type, 
    request : HttpRequestMessage, 
    formatters : IEnumerable<MediaTypeFormatter>
) : Collection<MediaTypeFormatterMatch>

Parameters

  • request
    Type: HttpRequestMessage

    The request.

Return Value

Type: System.Collections.ObjectModel.Collection<MediaTypeFormatterMatch>
Returns a collection of MediaTypeFormatterMatch objects that represent all of the matches.

Remarks

This method associates a MediaTypeFormatterMatchRanking valuewith each formatter, and then sets the quality of the match based on q-factors and other criteria. The result is a collection of the matches, with the category of the match and the assigned quality value.

See Also

Reference

DefaultContentNegotiator Class

System.Net.Http.Formatting Namespace