Class TemplateExtensions
Contains extension method for handling url templates.
Inheritance
Namespace: StylelabsStylelabs.MSdkWebClientHttp
Assembly: Stylelabs.M.Sdk.WebClient.dll
Syntax
public static class TemplateExtensionsMethods
Bind(Link, IDictionary<string, string>)
Parses the link's template and applies the specified values to it.
Declaration
public static string Bind(this Link link, IDictionary<string, string> values)Parameters
| Type | Name | Description |
|---|---|---|
| Link | link |
The link to parse. |
| IDictionary<, >stringstring | values |
The values of the templatized parameters. |
Returns
| Type | Description |
|---|---|
| string |
The link's template with it's parameters replaced by the specified values. |
Bind(Link, object)
Parses the link's template and applies the specified values to it.
Declaration
public static string Bind(this Link link, object values = null)Parameters
| Type | Name | Description |
|---|---|---|
| Link | link |
The link to parse. |
| object | values |
The values of the templatized parameters. |
Returns
| Type | Description |
|---|---|
| string |
The link's template with it's parameters replaced by the specified values. |
GetVariableValue(Link, Link, string)
Extracts the value of the specified variable from the link based on a given template.
Declaration
public static string GetVariableValue(this Link link, Link template, string variable)Parameters
| Type | Name | Description |
|---|---|---|
| Link | link |
The link to extract the variable from. |
| Link | template |
The template that defines the variables. |
| string | variable |
The name of the variable to extract. |
Returns
| Type | Description |
|---|---|
| string |
The value of the variable or null if the variable could not be found. |
GetVariableValue(Uri, Link, string)
Extracts the value of the specified variable from the uri based on a given template.
Declaration
public static string GetVariableValue(this Uri uri, Link template, string variable)Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri |
The uri to extract the variable from. |
| Link | template |
The template that defines the variables. |
| string | variable |
The name of the variable to extract. |
Returns
| Type | Description |
|---|---|
| string |
The value of the variable or null if the variable could not be found. |