This class contains extension methods that are provided as part of various Loyc.Collections interfaces. For example, it provides methods such as IndexOf(), Contains() and CopyTo(), that the traditional ICollection{T} and IList{T} interfaces require the author to write himself.
Extension methods for Loyc collection interfaces
For covariant collections such as IReadOnlyCollection{T} and IListSource{T}, the CLR actually prohibits methods such as Contains(T) and IndexOf(T), because T is not allowed in "input" positions. Therefore, these extension methods must be used to fill the gap. Even methods such as bool TryGet(int, out T) are prohibited, so TryGet() has the signature T TryGet(ref bool failed) instead, and extension methods provide the original version of the method in addition.
|
static bool | Any (this ICount c) |
| Returns true if the collection contains any elements. More...
|
|
static bool | TryGet< T > (this IListSource< T > list, int index, ref T value) |
| Tries to get a value from the list at the specified index. More...
|
|
static T | TryGet< T > (this IListSource< T > list, int index, T defaultValue) |
| Tries to get a value from the list at the specified index. More...
|
|
static Maybe< T > | TryGet< T > (this IListSource< T > list, int index) |
| Tries to get a value from the list at the specified index. More...
|
|
static bool | HasIndex< T > (this IListSource< T > list, int index) |
| Uses list.TryGet(index) to find out if the specified index is valid. More...
|
|
static int | IndexOf< T > (this IReadOnlyList< T > list, T item) |
| Determines the index of a specific value. More...
|
|
static void | CopyTo< T > (this IReadOnlyList< T > c, T[] array, int arrayIndex) |
|
static int | IndexWhere< T > (this IReadOnlyList< T > source, Func< T, bool > pred) |
| Gets the lowest index at which a condition is true, or -1 if nowhere. More...
|
|
static int | LastIndexWhere< T > (this IReadOnlyList< T > source, Func< T, bool > pred) |
| Gets the highest index at which a condition is true, or -1 if nowhere. More...
|
|
static T[] | ToArray< T > (this IReadOnlyList< T > c) |
| Copies the contents of an IListSource to an array. More...
|
|
static T | LastOrDefault< T > (this IReadOnlyList< T > list) |
|
static T | FirstOrDefault< T > (this IReadOnlyList< T > list) |
|
static T | FirstOrDefault< T > (this IListSource< T > list) |
|
static bool | TryGet< T > (this INegListSource< T > list, int index, ref T value) |
| Tries to get a value from the list at the specified index. More...
|
|
static T | TryGet< T > (this INegListSource< T > list, int index, T defaultValue) |
| Tries to get a value from the list at the specified index. More...
|
|
static int | IndexOf< T > (this INegListSource< T > list, T item) |
| Determines the index of a specific value. More...
|
|
static int | NextHigherIndex< T > (this ISparseListSource< T > list, int?index) |
| Gets the next higher index that is not classified as an empty space, or null if there are no non-blank higher indexes. More...
|
|
static int | NextLowerIndex< T > (this ISparseListSource< T > list, int?index) |
| Gets the next lower index that is not classified as an empty space, or null if there are no non-blank lower indexes. More...
|
|
static IEnumerable
< KeyValuePair< int, T > > | Items< T > (this ISparseListSource< T > list) |
| Returns the non-cleared items in the sparse list, along with their indexes, sorted by index. More...
|
|
static T | Pop< T > (this IPop< T > c) |
|
static T | Peek< T > (this IPop< T > c) |
|
static bool | TryPop< T > (this IPop< T > c, out T value) |
|
static bool | TryPeek< T > (this IPop< T > c, out T value) |
|
static T | TryPop< T > (this IPop< T > c) |
|
static T | TryPeek< T > (this IPop< T > c) |
|
static T | TryPop< T > (this IPop< T > c, T defaultValue) |
|
static T | TryPeek< T > (this IPop< T > c, T defaultValue) |
|
static T | PopFirst< T > (this IDeque< T > c) |
|
static T | PopLast< T > (this IDeque< T > c) |
|
static T | PeekFirst< T > (this IDeque< T > c) |
|
static T | PeekLast< T > (this IDeque< T > c) |
|
static void | Resize< T > (this IListRangeMethods< T > list, int newSize) |
|