This documentation is archived and is not being maintained.

UriTemplateMatch.Template Property

Gets and sets the UriTemplate instance associated with this UriTemplateMatch instance.

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

'Declaration
Public Property Template As UriTemplate
'Usage
Dim instance As UriTemplateMatch 
Dim value As UriTemplate 

value = instance.Template

instance.Template = value

Property Value

Type: System.UriTemplate
A UriTemplate instance.

This property contains the UriTemplate that the candidate URI matched.

The following code shows how to access the Template property.

Dim template As New UriTemplate("weather/ state}/ city}?forecast=today")
Dim baseAddress As New Uri("http://localhost")
Dim fullUri As New Uri("http://localhost/weather/WA/Seattle?forecast=today")

Console.WriteLine("Matching  0} to  1}", template.ToString(), fullUri.ToString())

'Match a URI to a template 
Dim results As UriTemplateMatch = template.Match(baseAddress, fullUri)
If (results IsNot Nothing) Then
    Console.WriteLine("Template:")
    Console.WriteLine(results.Template)
End If 
'Code output: 
'Template: 
'weather/ state}/ city}?forecast=today

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5
Show: