Example #1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="isStack">Specifies the mode of this collection. Notice that
 /// either mode will return elements from this collection in it's mode
 /// --- element zero in the Sequence will be the Head of this Queue or the Top of
 /// this Stack.</param>
 /// <param name="collection">Not null.</param>
 public ImmutableSequence(bool isStack, ISequenceView <T> collection)
 {
     if (collection == null)
     {
         throw new ArgumentNullException(nameof(collection));
     }
     array   = collection.ToArray();
     IsStack = isStack;
 }
Example #2
0
 public Sequence(ISequenceView <T> collection, float growFactor = 2F)
 {
     if (growFactor <= 1F)
     {
         throw new ArgumentOutOfRangeException(nameof(growFactor));
     }
     array      = collection?.ToArray() ?? throw new ArgumentNullException(nameof(collection));
     count      = array.Length;
     GrowFactor = growFactor;
     IsStack    = collection.IsStack;
     setElementType();
 }