Terradue.OpenSearch.OpenSearchParameterValueSet.GetQueryString C# (CSharp) Method

GetQueryString() public method

Gets a NameValueCollection representing the parameters and their values.
public GetQueryString ( bool allParameters ) : string
allParameters bool If set to true, the NameValueCollection includes also unset parameters.
return string
        public string GetQueryString(bool allParameters)
        {
            StringBuilder result = new StringBuilder(256);
            bool first = true;
            foreach (OpenSearchParameterDefinition paramDef in parametersByName.Values) {
                if (!values.ContainsKey(paramDef)) {
                    if (allParameters) {
                        result.Append(String.Format("{1}{0}=", paramDef.Name, first ? String.Empty : "&"));
                        first = false;
                    }
                    continue;
                }
                foreach (string value in values[paramDef]) {
                    result.Append(String.Format("{2}{0}={1}", paramDef.Name, HttpUtility.HtmlEncode(value), first ? String.Empty : "&"));
                    first = false;
                }
            }
            return result.ToString();
        }