private IEnumerable <string> GetPairs(bool encodeSpaceAsPlus) { foreach (var key in orderedKeys) { var val = this[key]; if (val == null) { continue; } if (val is string || !(val is IEnumerable)) { yield return(key + "=" + UrlBuilder.EncodeQueryParamValue(val, encodeSpaceAsPlus)); } else { // if value is IEnumerable (other than string), break it into multiple // values with same param name, i.e. x=1&x2&x=3 // https://github.com/tmenier/Flurl/issues/15 foreach (var subval in val as IEnumerable) { if (subval == null) { continue; } yield return(key + "=" + UrlBuilder.EncodeQueryParamValue(subval, encodeSpaceAsPlus)); } } } }