Compartilhar via


DefaultContentNegotiator Constructor (Boolean)

Initializes a new instance of the DefaultContentNegotiator class.

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

Syntax

'Declaration
Public Sub New ( _
    excludeMatchOnTypeOnly As Boolean _
)
'Usage
Dim excludeMatchOnTypeOnly As Boolean 

Dim instance As New DefaultContentNegotiator(excludeMatchOnTypeOnly)
public DefaultContentNegotiator(
    bool excludeMatchOnTypeOnly
)
public:
DefaultContentNegotiator(
    bool excludeMatchOnTypeOnly
)
new : 
        excludeMatchOnTypeOnly:bool -> DefaultContentNegotiator
public function DefaultContentNegotiator(
    excludeMatchOnTypeOnly : boolean
)

Parameters

  • excludeMatchOnTypeOnly
    Type: System.Boolean

    true to exclude formatters that match only on the object type; otherwise, false.

Remarks

The excludeMatchOnTypeOnly parameter controls the behavior when the Negotiate method cannot find a formatter that matches the anything in the request:

  • If excludeMatchOnTypeOnly is true, the Negotiate method returns null. This option is useful for generating 406 (Not Acceptable) status codes.

  • If excludeMatchOnTypeOnly is false, the Negotiate method returns the first formatter that can serialize the type. This option means the client is more likely to receive a valid entity body, although the format might not match the request.

See Also

Reference

DefaultContentNegotiator Class

DefaultContentNegotiator Overload

System.Net.Http.Formatting Namespace