Пример #1
0
            public override object[] ToArray()
            {
                object[] array;

                lock (root)
                {
                    array = deque.ToArray();
                }

                return(array);
            }
Пример #2
0
        public void ToArray()
        {
            var deque = new Deque<int>();
              var array = deque.ToArray();
              Assert.AreEqual(0, array.Length);

              deque = new Deque<int>(new[] { 2, 3, 4 });
              array = deque.ToArray();
              Assert.AreEqual(3, array.Length);
              Assert.AreEqual(2, array[0]);
              Assert.AreEqual(3, array[1]);
              Assert.AreEqual(4, array[2]);
        }
Пример #3
0
        private static void TestToArray(Deque deque)
        {
            deque.Clear();

            PopulateDequePushBack(deque);

            object[] array = deque.ToArray();
            int i = 0;

            foreach(object obj in deque)
            {
                Debug.Assert(obj.Equals(array[i]));
                i++;
            }
        }