Hi having array of ints like ages int[]{123, 234}
how to select it to string which can be used as get request ages=123&ages=234
To do proper URL encoding, you can use HttpUtility.ParseQueryString() like this:
var query = System.Web.HttpUtility.ParseQueryString(string.Empty);
foreach (var age in ages)
{
query.Add("ages", age.ToString());
}
// or: ages.ToList().ForEach(age => query.Add("ages", age.ToString()));
return query.ToString();
However, this will lead to ages=123,234.
agesconstant in request must the same of the variable name or i can use constant likeages?