Class CollectionExtensions
- Namespace
- AlgorithmsSW
- Assembly
- AlgorithmsSW.dll
Provides extension methods for collections that do not belong to any specific collection type.
public static class CollectionExtensions
- Inheritance
-
CollectionExtensions
- Inherited Members
Remarks
This includes extension methods for collections defined in this library, and collections in the standard library.
Methods
Contains<T>(ResizeableArray<T>, IEqualityComparer<T>, T)
public static bool Contains<T>(this ResizeableArray<T> list, IEqualityComparer<T> comparer, T item)
Parameters
list
ResizeableArray<T>comparer
IEqualityComparer<T>item
T
Returns
Type Parameters
T
CopyTo<T>(IEnumerable<T>, IRandomAccessList<T>, int)
public static void CopyTo<T>(this IEnumerable<T> source, IRandomAccessList<T> array, int arrayIndex = 0)
Parameters
source
IEnumerable<T>array
IRandomAccessList<T>arrayIndex
int
Type Parameters
T
CopyTo<T>(IEnumerable<T>, T[], int)
public static void CopyTo<T>(this IEnumerable<T> source, T[] array, int arrayIndex = 0)
Parameters
source
IEnumerable<T>array
T[]arrayIndex
int
Type Parameters
T
Copy<TStack, T>(TStack)
public static TStack Copy<TStack, T>(this TStack stack) where TStack : IStack<T>, new()
Parameters
stack
TStack
Returns
- TStack
Type Parameters
TStack
T
GenerateAllPairs<T>(IEnumerable<T>)
public static IEnumerable<(T item1, T item2)> GenerateAllPairs<T>(this IEnumerable<T> source)
Parameters
source
IEnumerable<T>
Returns
- IEnumerable<(T item1, T item2)>
Type Parameters
T
GenerateDistinctPairs<T>(IEnumerable<T>)
public static IEnumerable<(T item1, T item2)> GenerateDistinctPairs<T>(this IEnumerable<T> source)
Parameters
source
IEnumerable<T>
Returns
- IEnumerable<(T item1, T item2)>
Type Parameters
T
Group<T>(IEnumerable<T>, int)
Groups the elements of a sequence into fixed-size chunks.
public static IEnumerable<IEnumerable<T>> Group<T>(this IEnumerable<T> source, int size)
Parameters
source
IEnumerable<T>size
int
Returns
Type Parameters
T
ToResizableArray<T>(ResizeableArray<T>)
public static ResizeableArray<T> ToResizableArray<T>(this ResizeableArray<T> array)
Parameters
array
ResizeableArray<T>
Returns
Type Parameters
T
ToResizableArray<T>(IEnumerable<T>)
public static ResizeableArray<T> ToResizableArray<T>(this IEnumerable<T> items)
Parameters
items
IEnumerable<T>
Returns
Type Parameters
T
ToResizableArray<T>(IEnumerable<T>, int)
public static ResizeableArray<T> ToResizableArray<T>(this IEnumerable<T> items, int capacity)
Parameters
items
IEnumerable<T>capacity
int
Returns
Type Parameters
T
ToSet<T>(IEnumerable<T>, IComparer<T>)
public static ISet<T> ToSet<T>(this IEnumerable<T> items, IComparer<T> comparer)
Parameters
items
IEnumerable<T>comparer
IComparer<T>
Returns
- ISet<T>
Type Parameters
T