Skip to content

Instantly share code, notes, and snippets.

@czenzel
Created November 6, 2018 21:03
Show Gist options
  • Save czenzel/b553bd34089e335b3da049f68a08a0a1 to your computer and use it in GitHub Desktop.
Save czenzel/b553bd34089e335b3da049f68a08a0a1 to your computer and use it in GitHub Desktop.
Simple Combine Key-Value Dictionary to Query String Parameters (WIP: Could use improvements)
public static class Extensions
{
public static string CombineToQuerystring(this Dictionary<string, string> Components)
{
List<string> objStrings = new List<string>();
foreach (var objParam in Components)
objStrings.Add(string.Format(@"{0}={1}", objParam.Key, objParam.Value));
return string.Join("&", objStrings.ToArray());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment