public static unsafe void RemoveFirst <TElement>(this IRemove <TElement> collection, TElement *elements, Int32 length) where TElement : unmanaged { for (Int32 i = 0; i < length; i++) { collection.RemoveFirst(elements[i]); } }
/// <summary> /// Removes the first instance of the elements from this object. /// </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 remove.</param> public static void RemoveFirst <TElement>(this IRemove <TElement> collection, ReadOnlySpan <TElement> elements) { for (Int32 i = 0; i < elements.Length; i++) { collection.RemoveFirst(elements[i]); } }
/// <summary> /// Removes the first instance of the elements from this object. /// </summary> /// <typeparam name="TElement">The type of the elements in the collection.</typeparam> /// <typeparam name="TEnumerator">The type of the enumerator of the <paramref name="elements"/>.</typeparam> /// <param name="collection">This collection.</param> /// <param name="elements">The elements to remove.</param> public static void RemoveFirst <TElement, TEnumerator>(this IRemove <TElement> collection, IGetEnumerator <TElement, TEnumerator>?elements) where TEnumerator : notnull, ICurrent <TElement>, IMoveNext { if (elements is not null) { foreach (TElement element in elements) { collection.RemoveFirst(element); } } }
/// <summary> /// Removes the first instance of the elements from this object. /// </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 remove.</param> public static void RemoveFirst <TElement>(this IRemove <TElement> collection, Collections.Generic.IEnumerable <TElement>?elements) { if (elements is not null) { foreach (TElement element in elements) { collection.RemoveFirst(element); } } }