Class TemplateExtensions
Contains extension method for handling url templates.
Inheritance
Namespace: Stylelabs.M.Sdk.WebClient.Http
Assembly: Stylelabs.M.Sdk.WebClient.dll
Syntax
public static class TemplateExtensions : object
Methods
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<System.String, System.String> | values | The values of the templatized parameters. |
Returns
Type | Description |
---|---|
System.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. |
System.Object | values | The values of the templatized parameters. |
Returns
Type | Description |
---|---|
System.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. |
System.String | variable | The name of the variable to extract. |
Returns
Type | Description |
---|---|
System.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. |
System.String | variable | The name of the variable to extract. |
Returns
Type | Description |
---|---|
System.String | The value of the variable or null if the variable could not be found. |
Can we improve this article ? Provide feedback