-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Labels
enhancementhelp wantedThis issue is available to submit a pull request forThis issue is available to submit a pull request for
Description
Running in LinqPad:
void Main()
{
var apiPath = "api/v2/{BrokerDealerId}/{PartyId}/Household/{HouseholdId}/Accounts";
var template = new UriTemplate(apiPath);
template.BindByPosition("BID1124", "PID6677", "HH3456").Dump();
}
static class UriTemplateExtensions
{
public static string BindByPosition(this UriTemplate template, params string[] values)
{
if (template == null) throw new ArgumentNullException("template", "The expected URI template is not here.");
var keys = template.GetParameterNames();
var set = keys
.Zip(values, (i, j) => new KeyValuePair<string, string>(i, j))
.ToDictionary(i => i.Key, j => j.Value);
return template.AddParameters(set).Resolve();
}
}Metadata
Metadata
Assignees
Labels
enhancementhelp wantedThis issue is available to submit a pull request forThis issue is available to submit a pull request for
