Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
BaseAddress Property
Collapse the table of content
Expand the table of content

UriTemplateTable.BaseAddress Property

Gets and sets the base address for the UriTemplateTable instance.

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

'Declaration
Public Property BaseAddress As Uri

Property Value

Type: System.Uri
A Uri that contains the base address.

The BaseAddress property can only be set prior to calling MakeReadOnly(Boolean) or Match(Uri) or MatchSingle(Uri) otherwise an InvalidOperationException is thrown.

The following example shows how to access the BaseAddress property.

' Create a series of templates 
Dim weatherByCity As New UriTemplate("weather/{state}/{city}")
Dim weatherByCountry As New UriTemplate("weather/{country}/{village}")
Dim weatherByState As New UriTemplate("weather/{state}")
Dim traffic As New UriTemplate("traffic/*")
Dim wildcard As New UriTemplate("*")

' Add each template to the table with some associated data 
Dim list As New List(Of KeyValuePair(Of UriTemplate, Object))()
list.Add(New KeyValuePair(Of UriTemplate, Object)(weatherByCity, "weatherByCity"))
list.Add(New KeyValuePair(Of UriTemplate, Object)(weatherByCountry, "weatherByCountry"))
list.Add(New KeyValuePair(Of UriTemplate, Object)(weatherByState, "weatherByState"))
list.Add(New KeyValuePair(Of UriTemplate, Object)(traffic, "traffic"))

'Create a template table 
Dim table As New UriTemplateTable(list)
table.BaseAddress = New Uri("http://localhost/")
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