Пример #1
0
 // Fills a Stack with the contents of a particular collection.  The items are
 // pushed onto the stack in the same order they are read by the enumerator.
 public FormsStack(IEnumerable <T> collection)
 {
     if (collection == null)
     {
         throw new ArgumentNullException(nameof(collection));
     }
     _array = FormsEnumerableHelpers.ToArray(collection, out _size);
 }
Пример #2
0
        // Fills a Queue with the elements of an ICollection.  Uses the enumerator
        // to get each of the elements.
        public FormsQueue(IEnumerable <T> collection)
        {
            Init();
            if (collection == null)
            {
                throw new ArgumentNullException(nameof(collection));
            }

            _array = FormsEnumerableHelpers.ToArray(collection, out _size);
            if (_size != _array.Length)
            {
                _tail = _size;
            }
        }