forked from aspnet/AspNetWebStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContentNegotiationResult.cs
More file actions
55 lines (49 loc) · 1.76 KB
/
Copy pathContentNegotiationResult.cs
File metadata and controls
55 lines (49 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Net.Http.Headers;
using System.Web.Http;
namespace System.Net.Http.Formatting
{
/// <summary>
/// Represents the result of content negotiation performed using
/// <see cref="IContentNegotiator.Negotiate(Type, HttpRequestMessage, IEnumerable{MediaTypeFormatter})"/>
/// </summary>
public class ContentNegotiationResult
{
private MediaTypeFormatter _formatter;
/// <summary>
/// Create the content negotiation result object.
/// </summary>
/// <param name="formatter">The formatter.</param>
/// <param name="mediaType">The preferred media type. Can be <c>null</c>.</param>
public ContentNegotiationResult(MediaTypeFormatter formatter, MediaTypeHeaderValue mediaType)
{
if (formatter == null)
{
throw Error.ArgumentNull("formatter");
}
_formatter = formatter;
MediaType = mediaType;
}
/// <summary>
/// The formatter chosen for serialization.
/// </summary>
public MediaTypeFormatter Formatter
{
get { return _formatter; }
set
{
if (value == null)
{
throw Error.ArgumentNull("value");
}
_formatter = value;
}
}
/// <summary>
/// The media type that is associated with the formatter chosen for serialization. Can be <c>null</c>.
/// </summary>
public MediaTypeHeaderValue MediaType { get; set; }
}
}