// 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 Stack(IEnumerable <T> collection) { if (collection == null) { throw new ArgumentNullException(nameof(collection)); } _array = EnumerableHelpers.ToArray(collection, out _size); }
// Fills a Queue with the elements of an ICollection. Uses the enumerator // to get each of the elements. // /// <include file='doc\Queue.uex' path='docs/doc[@for="Queue.Queue3"]/*' /> public Queue(IEnumerable <T> collection) { if (collection == null) { throw new ArgumentNullException("collection"); } _array = EnumerableHelpers.ToArray(collection, out _size); _tail = (_size == _array.Length) ? 0 : _size; }
// Fills a Queue with the elements of an ICollection. Uses the enumerator // to get each of the elements. public Queue(IEnumerable <T> collection) { ArgumentNullException.ThrowIfNull(collection); _array = EnumerableHelpers.ToArray(collection, out _size); if (_size != _array.Length) { _tail = _size; } }
// 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 Stack(IEnumerable <T> collection) { if (collection == null) { throw new ArgumentNullException("collection"); } int length; _array = EnumerableHelpers.ToArray(collection, out length); _size = length; }
// Fills a Queue with the elements of an ICollection. Uses the enumerator // to get each of the elements. public Queue(IEnumerable <T> collection) { if (collection == null) { throw new ArgumentNullException(nameof(collection)); } _array = EnumerableHelpers.ToArray(collection, out _size); if (_size != _array.Length) { _tail = _size; } }
// 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 Stack(IEnumerable <T> collection) { ArgumentNullException.ThrowIfNull(collection); _array = EnumerableHelpers.ToArray(collection, out _size); }