ServiceStack.NameValueCollectionExtensions.ToDictionary C# (CSharp) Метод

ToDictionary() публичный статический Метод

public static ToDictionary ( this nameValues ) : string>.Dictionary
nameValues this
Результат string>.Dictionary
        public static Dictionary<string, string> ToDictionary(this System.Collections.Specialized.NameValueCollection nameValues)
        {
            if (nameValues == null) return new Dictionary<string, string>();

            var map = new Dictionary<string, string>();
            foreach (var key in nameValues.AllKeys)
            {
                if (key == null)
                {
                    //occurs when no value is specified, e.g. 'path/to/page?debug'
                    //throw new ArgumentNullException("key", "nameValues: " + nameValues);
                    continue;
                }

                var values = nameValues.GetValues(key);
                if (values != null && values.Length > 0)
                {
                    map[key] = values[0];
                }
            }
            return map;
        }
NameValueCollectionExtensions