UriTemplateTable.IsReadOnly Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets a value that specifies whether the UriTemplateTable is read only.

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

Public ReadOnly Property IsReadOnly As Boolean

Property Value

Type: System.Boolean

true if the UriTemplateTable property is read only; otherwise false.

A UriTemplateTable is read only after the MakeReadOnly(Boolean) method is called.

The following example shows how to access the IsReadOnly property.

Dim baseAddress As New Uri("http://localhost/")
' Create a series of templates
Dim weatherByCity = New UriTemplate("weather/{state}/{city}")
Dim weatherByCountry = New UriTemplate("weather/{country}/{village}")
Dim weatherByState = New UriTemplate("weather/{state}")
Dim traffic = New UriTemplate("traffic/*")
Dim wildcard = 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(baseAddress, list)
If (table.IsReadOnly) Then
    Console.WriteLine("UriTemplateTable is read only")
    Console.WriteLine("UriTemplateTable is not read only")
End If

.NET Framework
Available since 3.5
Return to top