Exemple #1
0
 public static unsafe void Prepend <TElement>(this IPrepend <TElement> collection, TElement *elements, Int32 length) where TElement : unmanaged
 {
     for (Int32 i = length - 1; i >= 0; i--)
     {
         collection.Prepend(elements[i]);
     }
 }
Exemple #2
0
 /// <summary>
 /// Prepends the elements onto this object, one by one.
 /// </summary>
 /// <typeparam name="TElement">The type of the elements in the collection.</typeparam>
 /// <param name="collection">This collection.</param>
 /// <param name="elements">The elements to prepend.</param>
 public static void Prepend <TElement>(this IPrepend <TElement> collection, ReadOnlySpan <TElement> elements)
 {
     for (Int32 i = elements.Length - 1; i >= 0; i--)
     {
         collection.Prepend(elements[i]);
     }
 }
Exemple #3
0
 /// <summary>
 /// Prepends the elements onto this object, one by one.
 /// </summary>
 /// <typeparam name="TElement">The type of the elements in the collection.</typeparam>
 /// <typeparam name="TEnumerator">The type of the enumerator for the <paramref name="elements"/>.</typeparam>
 /// <param name="collection">This collection.</param>
 /// <param name="elements">The elements to prepend.</param>
 public static void Prepend <TElement, TEnumerator>(this IPrepend <TElement> collection, IGetEnumerator <TElement, TEnumerator>?elements) where TEnumerator : notnull, ICurrent <TElement>, IMoveNext
 {
     if (elements is not null)
     {
         foreach (TElement element in elements)
         {
             collection.Prepend(element);
         }
     }
 }
Exemple #4
0
 /// <summary>
 /// Prepends the elements onto this object, one by one.
 /// </summary>
 /// <typeparam name="TElement">The type of the elements in the collection.</typeparam>
 /// <param name="collection">This collection.</param>
 /// <param name="elements">The elements to prepend.</param>
 public static void Prepend <TElement>(this IPrepend <TElement> collection, Collections.Generic.IEnumerable <TElement>?elements)
 {
     if (elements is not null)
     {
         foreach (TElement element in elements)
         {
             collection.Prepend(element);
         }
     }
 }
Exemple #5
0
 /// <summary>
 /// Prepends the elements onto this object, one by one.
 /// </summary>
 /// <param name="collection">This collection.</param>
 /// <param name="elements">The elements to prepend.</param>
 public static void Prepend(this IPrepend <Char> collection, String?elements) => Prepend(collection, elements.AsSpan());
Exemple #6
0
 /// <summary>
 /// Prepends the elements onto this object, one by one.
 /// </summary>
 /// <typeparam name="TElement">The type of the elements in the collection.</typeparam>
 /// <param name="collection">This collection.</param>
 /// <param name="elements">The elements to prepend.</param>
 public static void Prepend <TElement>(this IPrepend <TElement> collection, Span <TElement> elements) => Prepend(collection, (ReadOnlySpan <TElement>)elements);
Exemple #7
0
 /// <summary>
 /// Prepends the elements onto this object, one by one.
 /// </summary>
 /// <typeparam name="TElement">The type of the elements in the collection.</typeparam>
 /// <param name="collection">This collection.</param>
 /// <param name="elements">The elements to prepend.</param>
 public static void Prepend <TElement>(this IPrepend <TElement> collection, ReadOnlyMemory <TElement> elements) => Prepend(collection, elements.Span);
Exemple #8
0
 /// <summary>
 /// Prepends the elements onto this object, one by one.
 /// </summary>
 /// <typeparam name="TElement">The type of the elements in the collection.</typeparam>
 /// <param name="collection">This collection.</param>
 /// <param name="elements">The elements to prepend.</param>
 public static void Prepend <TElement>(this IPrepend <TElement> collection, ArraySegment <TElement> elements) => Prepend(collection, elements.AsSpan());
Exemple #9
0
 /// <summary>
 /// Prepends the elements onto this object, one by one.
 /// </summary>
 /// <typeparam name="TElement">The type of the elements in the collection.</typeparam>
 /// <param name="collection">This collection.</param>
 /// <param name="elements">The elements to prepend.</param>
 public static void Prepend <TElement>(this IPrepend <TElement> collection, params TElement[]?elements) => Prepend(collection, elements.AsSpan());