Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
UriTemplateTable Constructor (Uri, IEnumerable(KeyValuePair(UriTemplate, Object)))

UriTemplateTable Constructor (Uri, IEnumerable<KeyValuePair<UriTemplate, Object>>)

Initializes a new instance of the UriTemplateTable class with the specified base address and collection of key/value pairs.

Namespace:  System
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public UriTemplateTable(
	Uri baseAddress,
	IEnumerable<KeyValuePair<UriTemplate, Object>> keyValuePairs
)

Parameters

baseAddress
Type: System.Uri

A Uri instance that contains the base address.

keyValuePairs
Type: System.Collections.Generic.IEnumerable<KeyValuePair<UriTemplate, Object>>

A collection of key/value pairs that consist of URI templates and associated data.

The following example shows how to call this constructor.

Uri baseAddress = new Uri("http://localhost/");
//Create a series of templates
UriTemplate weatherByCity = new UriTemplate("weather/{state}/{city}");
UriTemplate weatherByCountry = new UriTemplate("weather/{country}/{village}");
UriTemplate weatherByState = new UriTemplate("weather/{state}");
UriTemplate traffic = new UriTemplate("traffic/*");
UriTemplate wildcard = new UriTemplate("*");

//Add each template to the table with some associated data
List<KeyValuePair<UriTemplate, Object>> list = new List<KeyValuePair<UriTemplate, object>>();
list.Add(new KeyValuePair<UriTemplate, Object>(weatherByCity, "weatherByCity"));
list.Add(new KeyValuePair<UriTemplate, Object>(weatherByCountry, "weatherByCountry"));
list.Add(new KeyValuePair<UriTemplate, Object>(weatherByState, "weatherByState"));
list.Add(new KeyValuePair<UriTemplate, Object>(traffic, "traffic"));

//Create a template table
UriTemplateTable table = new UriTemplateTable(baseAddress, list);
table.MakeReadOnly(true);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft