コード例 #1
0
        public static HttpHeaderDictionary FromString(string value)
        {
            if (null == value)
            {
                throw new ArgumentNullException("value");
            }

            var result = new HttpHeaderDictionary();

#if NET20
            var lines = IEnumerableExtensionMethods.ToQueue(StringExtensionMethods.Split(value, Environment.NewLine, StringSplitOptions.None));
#else
            var lines = value.Split(Environment.NewLine, StringSplitOptions.None).ToQueue();
#endif
            if (0 == lines.Count)
            {
                return(result);
            }

            while (0 != lines.Count)
            {
                var line = lines.Dequeue();
                if (0 == line.Length)
                {
                    break;
                }

                result.Add(HttpHeader.FromString(line));
            }

            return(result);
        }
コード例 #2
0
        public void op_Contains_Token()
        {
            var obj = new HttpHeaderDictionary();

            Assert.False(obj.Contains("name"));

            obj.Add(new HttpHeader("name", "value"));

            Assert.True(obj.Contains("name"));
        }