/// <summary> /// Converts the specified <paramref name="query"/> into its <see cref="NameValueCollection"/> equivalent. /// </summary> /// <param name="query">The query string values to convert.</param> /// <param name="urlDecode">Specify <c>true</c> to decode the <paramref name="query"/> that has been encoded for transmission in a URL; otherwise, <c>false</c>.</param> /// <returns>A <see cref="NameValueCollection"/> equivalent to the values in the <paramref name="query"/>.</returns> public static NameValueCollection FromString(string query, bool urlDecode) { Validator.ThrowIfNull(query, nameof(query)); return(Infrastructure.ParseFieldValuePairs(query, FieldValueSeparator.Ampersand, urlDecode)); }
/// <summary> /// Converts the specified <paramref name="form"/> into its <see cref="NameValueCollection"/> equivalent. /// </summary> /// <param name="form">The form-data values to convert.</param> /// <returns>A <see cref="NameValueCollection"/> equivalent to the values in the <paramref name="form"/>.</returns> public static NameValueCollection FromString(string form) { Validator.ThrowIfNull(form, nameof(form)); return(Infrastructure.ParseFieldValuePairs(form, FieldValueSeparator.Semicolon, false)); }
/// <summary> /// Converts the specified <paramref name="headers"/> into its <see cref="string"/> equivalent. /// </summary> /// <param name="headers">The request-header values to convert.</param> /// <returns>A <see cref="string"/> equivalent to the values in the <paramref name="headers"/>.</returns> public static string FromNameValueCollection(NameValueCollection headers) { Validator.ThrowIfNull(headers, nameof(headers)); return(Infrastructure.ParseFieldValuePairs(headers, FieldValueSeparator.Semicolon, false)); }