Repository navigation
Releases: gilad-teller/QueryStringHelper
Releases · gilad-teller/QueryStringHelper
Release list
1.0.1
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
- @gilad-teller made their first contribution in #2
Full Changelog: 1.0.0...1.0.1
1.0.0
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=2Use 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