Skip to content

Instantly share code, notes, and snippets.

@davidvesely
Created July 22, 2017 19:28
Show Gist options
  • Select an option

  • Save davidvesely/7765df0e861bff2992a62777c1386247 to your computer and use it in GitHub Desktop.

Select an option

Save davidvesely/7765df0e861bff2992a62777c1386247 to your computer and use it in GitHub Desktop.
Convert NameValueCollection to query string
public static string ConvertToQueryString(NameValueCollection queryParameters)
{
return string.Join("&", queryParameters.AllKeys
.Select(a => $"{HttpUtility.UrlEncode(a)}={HttpUtility.UrlEncode(queryParameters[a])}"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment