MediaTypeFormatterExtensions.AddMediaRangeMapping Method (MediaTypeFormatter, String, String)
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Updates the given formatter's set of MediaTypeMapping elements so that it associates the mediaType with requests or responses containing mediaRange in the content headers.
Namespace: System.Net.Http.Formatting
Assembly: System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)
Syntax
'Declaration
<ExtensionAttribute> _
Public Shared Sub AddMediaRangeMapping ( _
formatter As MediaTypeFormatter, _
mediaRange As String, _
mediaType As String _
)
public static void AddMediaRangeMapping(
this MediaTypeFormatter formatter,
string mediaRange,
string mediaType
)
[ExtensionAttribute]
public:
static void AddMediaRangeMapping(
MediaTypeFormatter^ formatter,
String^ mediaRange,
String^ mediaType
)
static member AddMediaRangeMapping :
formatter:MediaTypeFormatter *
mediaRange:string *
mediaType:string -> unit
public static function AddMediaRangeMapping(
formatter : MediaTypeFormatter,
mediaRange : String,
mediaType : String
)
Parameters
- formatter
Type: System.Net.Http.Formatting.MediaTypeFormatter
The MediaTypeFormatter to receive the new MediaRangeMapping item.
- mediaRange
Type: System.String
The media range that will appear in the content headers.
- mediaType
Type: System.String
The media type to associate with that mediaRange.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type MediaTypeFormatter. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.