Example #1
0
        /// <summary>
        /// URL encodes the parameters
        /// </summary>
        /// <param name="queryParams">Parameters</param>
        /// <returns>URL encoded result</returns>
        public string UrlEncodeParams(QueryParams queryParams)
        {
            var array = (from key in queryParams.AllKeys
                         from value in queryParams.GetValues(key)
                         where !string.IsNullOrEmpty(value)
                         select $"{HttpUtility.UrlEncode(key)}={HttpUtility.UrlEncode(value)}")
                        .ToArray();

            return(UnquoteUnreserved(string.Join("&", array)));
        }