UriTemplate UriTemplate UriTemplate UriTemplate Constructors

定义

重载

UriTemplate(String) UriTemplate(String) UriTemplate(String) UriTemplate(String)

使用指定的模板字符串初始化 UriTemplate 类的新实例。Initializes a new instance of the UriTemplate class with the specified template string.

UriTemplate(String, Boolean) UriTemplate(String, Boolean) UriTemplate(String, Boolean) UriTemplate(String, Boolean)

初始化 UriTemplate 类的新实例。Initializes a new instance of the UriTemplate class.

UriTemplate(String, IDictionary<String,String>) UriTemplate(String, IDictionary<String,String>) UriTemplate(String, IDictionary<String,String>) UriTemplate(String, IDictionary<String,String>)

初始化 UriTemplate 类的新实例。Initializes a new instance of the UriTemplate class.

UriTemplate(String, Boolean, IDictionary<String,String>) UriTemplate(String, Boolean, IDictionary<String,String>) UriTemplate(String, Boolean, IDictionary<String,String>) UriTemplate(String, Boolean, IDictionary<String,String>)

初始化 UriTemplate 类的新实例。Initializes a new instance of the UriTemplate class.

UriTemplate(String) UriTemplate(String) UriTemplate(String) UriTemplate(String)

使用指定的模板字符串初始化 UriTemplate 类的新实例。Initializes a new instance of the UriTemplate class with the specified template string.

public:
 UriTemplate(System::String ^ template);
public UriTemplate (string template);
new UriTemplate : string -> UriTemplate
Public Sub New (template As String)

参数

template
String String String String

模板。The template.

示例

下面的示例演示如何调用构造函数。The following example shows how to call the constructor.

UriTemplate template = new UriTemplate("weather/{state}/{city}?forecast={day}");
Dim template As UriTemplate = New UriTemplate("weather/{state}/{city}?forecast={day}")

UriTemplate(String, Boolean) UriTemplate(String, Boolean) UriTemplate(String, Boolean) UriTemplate(String, Boolean)

初始化 UriTemplate 类的新实例。Initializes a new instance of the UriTemplate class.

public:
 UriTemplate(System::String ^ template, bool ignoreTrailingSlash);
public UriTemplate (string template, bool ignoreTrailingSlash);
new UriTemplate : string * bool -> UriTemplate
Public Sub New (template As String, ignoreTrailingSlash As Boolean)

参数

template
String String String String

模板字符串。The template string.

ignoreTrailingSlash
Boolean Boolean Boolean Boolean

指定是否应忽略尾部正斜杠“/”字符的值。A value that specifies whether trailing slash "/" characters should be ignored.

注解

ignoreTrailingSlash 设置为 true 时,如果将候选 URI 与模板匹配,将忽略模板末尾处的尾部正斜杠。When the ignoreTrailingSlash is set to true, trailing slashes on the end of template are ignored when matching a candidate URI. 例如,模板(例如 http://www.microsoft.com/customer/)将匹配以下候选 Uri:For example, a template such as http://www.microsoft.com/customer/ would match the following candidate URIs:

  • http://www.microsoft.com/customer/
  • http://www.microsoft.com/customer
  • http://www.microsoft.com/customer/?wsdl
  • http://www.microsoft.com/customer?wsdl

UriTemplate(String, IDictionary<String,String>) UriTemplate(String, IDictionary<String,String>) UriTemplate(String, IDictionary<String,String>) UriTemplate(String, IDictionary<String,String>)

初始化 UriTemplate 类的新实例。Initializes a new instance of the UriTemplate class.

public:
 UriTemplate(System::String ^ template, System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^ additionalDefaults);
public UriTemplate (string template, System.Collections.Generic.IDictionary<string,string> additionalDefaults);
new UriTemplate : string * System.Collections.Generic.IDictionary<string, string> -> UriTemplate
Public Sub New (template As String, additionalDefaults As IDictionary(Of String, String))

参数

template
String String String String

模板字符串。The template string.

additionalDefaults
IDictionary<String,String>

一个字典,其中包含模板参数的默认值列表。A dictionary that contains a list of default values for the template parameters.

UriTemplate(String, Boolean, IDictionary<String,String>) UriTemplate(String, Boolean, IDictionary<String,String>) UriTemplate(String, Boolean, IDictionary<String,String>) UriTemplate(String, Boolean, IDictionary<String,String>)

初始化 UriTemplate 类的新实例。Initializes a new instance of the UriTemplate class.

public:
 UriTemplate(System::String ^ template, bool ignoreTrailingSlash, System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^ additionalDefaults);
public UriTemplate (string template, bool ignoreTrailingSlash, System.Collections.Generic.IDictionary<string,string> additionalDefaults);
new UriTemplate : string * bool * System.Collections.Generic.IDictionary<string, string> -> UriTemplate
Public Sub New (template As String, ignoreTrailingSlash As Boolean, additionalDefaults As IDictionary(Of String, String))

参数

template
String String String String

模板字符串。The template string.

ignoreTrailingSlash
Boolean Boolean Boolean Boolean

如果忽略尾部正斜杠“/”字符,则为 true;否则为 falsetrue if the trailing slash "/" characters are ignored; otherwise false.

additionalDefaults
IDictionary<String,String>

一个字典,其中包含模板参数的默认值列表。A dictionary that contains a list of default values for the template parameters.

适用于