Class TemplateExtensions

Current version: 3.4

Contains extension method for handling url templates.

Inheritance
object
TemplateExtensions
Namespace: StylelabsStylelabs.MSdkWebClientHttp
Assembly: Stylelabs.M.Sdk.WebClient.dll
Syntax
RequestResponse
public static class TemplateExtensions

Methods

Parses the link's template and applies the specified values to it.

Declaration
RequestResponse
public static string Bind(this Link link, IDictionary<string, string> values)
Parameters
TypeNameDescription
Linklink

The link to parse.

IDictionary<, >stringstringvalues

The values of the templatized parameters.

Returns
TypeDescription
string

The link's template with it's parameters replaced by the specified values.

Parses the link's template and applies the specified values to it.

Declaration
RequestResponse
public static string Bind(this Link link, object values = null)
Parameters
TypeNameDescription
Linklink

The link to parse.

objectvalues

The values of the templatized parameters.

Returns
TypeDescription
string

The link's template with it's parameters replaced by the specified values.

Extracts the value of the specified variable from the link based on a given template.

Declaration
RequestResponse
public static string GetVariableValue(this Link link, Link template, string variable)
Parameters
TypeNameDescription
Linklink

The link to extract the variable from.

Linktemplate

The template that defines the variables.

stringvariable

The name of the variable to extract.

Returns
TypeDescription
string

The value of the variable or null if the variable could not be found.

Extracts the value of the specified variable from the uri based on a given template.

Declaration
RequestResponse
public static string GetVariableValue(this Uri uri, Link template, string variable)
Parameters
TypeNameDescription
Uriuri

The uri to extract the variable from.

Linktemplate

The template that defines the variables.

stringvariable

The name of the variable to extract.

Returns
TypeDescription
string

The value of the variable or null if the variable could not be found.

Do you have some feedback for us?

If you have suggestions for improving this article,