次の方法で共有


MediaTypeFormatterExtensions.AddQueryStringMapping Method (MediaTypeFormatter, String, String, String)

Updates the given set of formatter of MediaTypeMapping elements so that it associates the mediaType with Uris containing a specific query parameter and value.

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

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Sub AddQueryStringMapping ( _
    formatter As MediaTypeFormatter, _
    queryStringParameterName As String, _
    queryStringParameterValue As String, _
    mediaType As String _
)
'Usage
Dim formatter As MediaTypeFormatter
Dim queryStringParameterName As String
Dim queryStringParameterValue As String
Dim mediaType As String

formatter.AddQueryStringMapping(queryStringParameterName, _
    queryStringParameterValue, mediaType)
public static void AddQueryStringMapping(
    this MediaTypeFormatter formatter,
    string queryStringParameterName,
    string queryStringParameterValue,
    string mediaType
)
[ExtensionAttribute]
public:
static void AddQueryStringMapping(
    MediaTypeFormatter^ formatter, 
    String^ queryStringParameterName, 
    String^ queryStringParameterValue, 
    String^ mediaType
)
static member AddQueryStringMapping : 
        formatter:MediaTypeFormatter * 
        queryStringParameterName:string * 
        queryStringParameterValue:string * 
        mediaType:string -> unit 
public static function AddQueryStringMapping(
    formatter : MediaTypeFormatter, 
    queryStringParameterName : String, 
    queryStringParameterValue : String, 
    mediaType : String
)

Parameters

  • queryStringParameterName
    Type: System.String
    The name of the query parameter.
  • queryStringParameterValue
    Type: System.String
    The value assigned to that query parameter.
  • mediaType
    Type: System.String
    The media type to associate with a Uri containing a query string matching queryStringParameterName and queryStringParameterValue.

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 https://msdn.microsoft.com/en-us/library/bb384936(v=vs.108) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).

See Also

Reference

MediaTypeFormatterExtensions Class

AddQueryStringMapping Overload

System.Net.Http.Formatting Namespace