DefaultContentNegotiator.ExcludeMatchOnTypeOnly Property
If true, exclude formatters that match only on the object type; otherwise, false.
Namespace: System.Net.Http.Formatting
Assembly: System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)
Syntax
'Declaration
Public Property ExcludeMatchOnTypeOnly As Boolean
Get
Private Set
'Usage
Dim instance As DefaultContentNegotiator
Dim value As Boolean
value = instance.ExcludeMatchOnTypeOnly
public bool ExcludeMatchOnTypeOnly { get; private set; }
public:
property bool ExcludeMatchOnTypeOnly {
bool get ();
private: void set (bool value);
}
member ExcludeMatchOnTypeOnly : bool with get, private set
function get ExcludeMatchOnTypeOnly () : boolean
private function set ExcludeMatchOnTypeOnly (value : boolean)
Property Value
Type: System.Boolean
Returns a Boolean.
Remarks
This property 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.
Set this type in the DefaultContentNegotiator constructor.