Skip to content

Releases: gilad-teller/QueryStringHelper

Release list

1.0.1

Choose a tag to compare

@gilad-teller gilad-teller released this 02 Dec 19:47
5be5f80

What's Changed

  • 1 fix: ensure duplicate keys are handled correctly in query string by @gilad-teller in #2
  • 1 fix: Add missing version number to project file by @gilad-teller in #3

New Contributors

Full Changelog: 1.0.0...1.0.1

1.0.0

Choose a tag to compare

@gilad-teller gilad-teller released this 26 Mar 20:04

QueryStringHelper

C# Helper library for building Query string

Use the static method to create a query string from a dictionary:

Dictionary<string, int> parameters = new()
{
    ["a"] = 1,
    ["b"] = 2
};
string queryString = QueryStringHelper.BuildQueryString(parameters);
Console.WriteLine(queryString); //a=1&b=2

Use the UriBuilder extension method to add the query string to the a URI:

Dictionary<string, string> parameters = new()
{
    ["a"] = "1",
    ["b"] = "2"
};
UriBuilder builder = new UriBuilder("http://www.sample.com")
    .AddQueryString(parameters);
string uri = builder.Uri.ToString();
Console.WriteLine(uri); //http://www.sample.com/?a=1&b=2