Edit

Share via


UriTemplate Constructors

Definition

Initializes a new instance of the UriTemplate class.

Overloads

UriTemplate(String)

Initializes a new instance of the UriTemplate class with the specified template string.

UriTemplate(String, Boolean)

Initializes a new instance of the UriTemplate class.

UriTemplate(String, IDictionary<String,String>)

Initializes a new instance of the UriTemplate class.

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

Initializes a new instance of the UriTemplate class.

UriTemplate(String)

Initializes a new instance of the UriTemplate class with the specified template string.

C#
public UriTemplate(string template);

Parameters

template
String

The template.

Examples

The following example shows how to call the constructor.

C#
UriTemplate template = new UriTemplate("weather/{state}/{city}?forecast={day}");

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

UriTemplate(String, Boolean)

Initializes a new instance of the UriTemplate class.

C#
public UriTemplate(string template, bool ignoreTrailingSlash);

Parameters

template
String

The template string.

ignoreTrailingSlash
Boolean

A value that specifies whether trailing slash "/" characters should be ignored.

Remarks

When the ignoreTrailingSlash is set to true, trailing slashes on the end of template are ignored when matching a candidate 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

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

UriTemplate(String, IDictionary<String,String>)

Initializes a new instance of the UriTemplate class.

C#
public UriTemplate(string template, System.Collections.Generic.IDictionary<string,string> additionalDefaults);

Parameters

template
String

The template string.

additionalDefaults
IDictionary<String,String>

A dictionary that contains a list of default values for the template parameters.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

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

Initializes a new instance of the UriTemplate class.

C#
public UriTemplate(string template, bool ignoreTrailingSlash, System.Collections.Generic.IDictionary<string,string> additionalDefaults);

Parameters

template
String

The template string.

ignoreTrailingSlash
Boolean

true 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.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1