/// <summary> /// Copies all the elements of the current sequence into an array. /// </summary> /// <param name="collection">This collection.</param> /// <param name="array">The array to copy items into.</param> /// <exception cref="ArgumentException">The destination is shorter than this sequence.</exception> /// <exception cref="ArgumentNullException">The destination is <see langword="null"/>.</exception> public static void CopyTo <TElement, TEnumerator>(this ISequence <TElement, TEnumerator> collection, ArraySegment <TElement> array) where TEnumerator : notnull, ICount, ICurrent <TElement>, IMoveNext, IReset => CopyTo(collection, array.AsSpan());
/// <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());
/// <summary> /// Inserts the elements into the collection at the specified index, one by one. /// </summary> /// <typeparam name="TElement">The type of the elements in the collection.</typeparam> /// <param name="collection">This collection.</param> /// <param name="index">The index at which the <paramref name="elements"/> should be inserted.</param> /// <param name="elements">The elements to insert.</param> public static void Insert <TElement>(this IInsert <Index, TElement> collection, Index index, ArraySegment <TElement> elements) => Insert(collection, index, elements.AsSpan());
/// <summary> /// Determines whether this collection contains all of the specified <paramref name="elements"/>. /// </summary> /// <typeparam name="TElement">The type of the elements in the collection.</typeparam> /// <typeparam name="TEnumerator">The type of the enumerator for the collection.</typeparam> /// <param name="collection">This collection.</param> /// <param name="elements">The elements to attempt to find.</param> /// <returns><see langword="true"/> if all of the <paramref name="elements"/> are contained in this collection; otherwise <see langword="false"/>.</returns> public static Boolean ContainsAll <TElement, TEnumerator>(this IGetEnumerator <TElement, TEnumerator> collection, ArraySegment <TElement> elements) where TEnumerator : notnull, ICurrent <TElement>, IMoveNext => ContainsAll(collection, elements.AsSpan());
public static ulong CalculateKnuthHash(this ArraySegment <char> chars) => Knuth(chars.AsSpan());
public static ImmutableMemory <T> ToImmutableMemory <T>(this ArraySegment <T> span, Int32 start, Int32 length) => new ImmutableMemory <T>(span.AsSpan(start, length));
public static ImmutableMemory <T> ToImmutableMemory <T>(this ArraySegment <T> array) => new ImmutableMemory <T>(array.AsSpan());
/// <summary> /// Adds the elements to this collection, 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 add.</param> /// <remarks> /// The behavior of this operation is type dependent, and no particular location in the collection should be assumed. It is further possible the type the element is added to is not a collection. /// </remarks> public static void Add <TElement>(this IAdd <TElement> collection, ArraySegment <TElement> elements) => Add(collection, elements.AsSpan());
/// <summary> /// Writes the <paramref name="elements"/>, 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 values to write.</param> public static void Write <TElement>(this IWrite <TElement> collection, ArraySegment <TElement> elements) => Write(collection, elements.AsSpan());
/// <summary> /// Pushs the elements onto this collection, 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 push.</param> public static void Push <TElement>(this IPush <TElement> collection, ArraySegment <TElement> elements) => Push(collection, elements.AsSpan());