System.ServiceModel
4.0.0.0
System.Object
A URI template allows you to define a set of structurally similar URIs. Templates are composed of two parts, a path and a query. A path consists of a series of segments delimited by a slash (/). Each segment can have a literal value, a variable value (written within curly braces [{ }], constrained to match the contents of exactly one segment), or a wildcard (written as an asterisk [*], which matches "the rest of the path"), which must appear at the end of the path. The query expression can be omitted entirely. If present, it specifies an unordered series of name/value pairs. Elements of the query expression can be either literal pairs (?x=2) or variable pairs (?x={val}). Unpaired values are not permitted. The following examples show valid template strings:
-
"weather/WA/Seattle"
-
"weather/{state}/{city}"
-
"weather/*"
-
"weather/{state}/{city}?forecast=today
-
"weather/{state}/{city}?forecast={day}
The preceding URI templates might be used for organizing weather reports. Segments enclosed in curly braces are variables, everything else is a literal. You can convert a instance into a by replacing variables with actual values. For example, taking the template "weather/{state}/{city}" and putting in values for the variables "{state}" and "{city}" gives you "weather/WA/Seattle". Given a candidate URI, you can test whether it matches a given URI template by calling . You can also use instances to create a from a set of variable values by calling or .
A class that represents a Uniform Resource Identifier (URI) template.
Constructor
4.0.0.0
To be added.
Initializes a new instance of the class with the specified template string.
The template.
Constructor
4.0.0.0
When the 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"
Initializes a new instance of the class.
The template string.
A value that specifies whether trailing slash “/” characters should be ignored.
Constructor
4.0.0.0
To be added.
Initializes a new instance of the class.
The template string.
A dictionary that contains a list of default values for the template parameters.
Constructor
4.0.0.0
To be added.
Initializes a new instance of the class.
The template string.
true if the trailing slash “/” characters are ignored; otherwise false.
A dictionary that contains a list of default values for the template parameters.
Method
4.0.0.0
System.Uri
The parameter contains a collection of parameter name and value pairs. The parameters are matched up against the variables within the template by a case-insensitive comparison.
The name/value collection passed to this method must contain a key for every template variable. Extra name/value pairs that do not match template variables are appended to the query string of the final URI.
It is possible to pass in text within the name/value pairs that prevent the generated URI from matching the template that is used to generate it. Examples of such text includes: '/', '..', '*', '{', and '}'.
Creates a new URI from the template and the collection of parameters.
A URI.
The base address.
A dictionary that contains a collection of parameter name/value pairs.
Method
4.0.0.0
System.Uri
The parameter contains a collection of parameter name/value pairs. The parameters are matched up against the variables within the template by a case-insensitive comparison. Values passed in this collection are escaped.
The name/value collection passed to must contain a key for every template variable. Extra name/value pairs that do not match template variables are appended to the query string of the final URI.
It is possible to pass in text within the name/value pairs that prevent the generated URI from matching the template that is used to generate it. Examples of such text includes: '/', '..', '*', '{', and '}'.
Creates a new URI from the template and the collection of parameters.
A new instance.
The base address.
The parameter values.
Method
4.0.0.0
System.Uri
To be added.
Creates a new URI from the template and the collection of parameters.
A URI.
A URI that contains the base address.
A dictionary that contains a collection of parameter name/value pairs.
true is the default values are ignored; otherwise false.
Method
4.0.0.0
System.Uri
To be added.
Creates a new URI from the template and the collection of parameters.
A URI.
The base address.
A collection of parameter name/value pairs.
true if the default values are ignored; otherwise false.
Method
4.0.0.0
System.Uri
System.ParamArray
The parameter values are bound by position left to right. The first parameter value replaces the first variable found in the template, the second parameter value replaces the second variable, and so on. Variables passed to this method are escaped.
The number of parameters passed in the values parameter must match the number of variables in the template. If not, a is thrown.
It is possible to pass in text within the parameter values array that prevents the generated URI from matching the template that is used to generate it. Examples of such text includes: '/', '.','..', '*', '{', and '}'. The following code demonstrates this.
UriTemplate template = new UriTemplate("far/{bat}/baz");
Uri uri = new Uri("http://localhost/Base");
Uri result = template.BindByPosition(uri, "."); // returns Base/form/baz
Uri result = template.BindByPosition(uri, ".."); // returns Base/baz
Uri result = template.BindByPosition(uri, "x/y"); // returns Base/form/x/y/baz
Uri result = template.BindByPosition(uri, "{x}"); // returns Base/form/{x}/baz
Uri result = template.BindByPosition(uri, "*"); // returns Base/form/*/baz
Creates a new URI from the template and an array of parameter values.
A new instance.
A that contains the base address.
The parameter values.
Property
4.0.0.0
System.Collections.Generic.IDictionary<System.String,System.String>
To be added.
To be added.
Gets a collection of name/value pairs for any default parameter values.
Property
4.0.0.0
System.Boolean
To be added.
To be added.
Specifies whether trailing slashes “/” in the template should be ignored when matching candidate URIs.
Method
4.0.0.0
System.Boolean
Two instances are equivalent if their literal strings are identical and the variables appear in the same segments. For example "weather/{state}/{city}" is equivalent to "weather/{country}/{village}".
Indicates whether a is structurally equivalent to another.
true if the is structurally equivalent to another; otherwise false.
The to compare.
Method
4.0.0.0
System.UriTemplateMatch
If the match is successful the is populated with the URI segments, variable values, query string values, and wildcard segments from the candidate URI. If the match is unsuccessful, null is returned.
Attempts to match a to a .
An instance.
The base address.
The to match against the template.
Property
4.0.0.0
System.Collections.ObjectModel.ReadOnlyCollection<System.String>
To be added.
The collection excludes the names of variables that appear in the query portion of the template.
Gets a collection of variable names used within path segments in the template.
Property
4.0.0.0
System.Collections.ObjectModel.ReadOnlyCollection<System.String>
To be added.
This collection excludes variable names that appear in the path section of the template string.
Gets a collection of variable names used within the query string in the template.
Method
4.0.0.0
System.String
To be added.
Returns a string representation of the instance.
The representation of the instance.