Enhanced C#
Language of your choice: library documentation
Static Public Member Functions | List of all members
Loyc.Collections.MutableListExtensionMethods.IListExt Class Reference

Extension methods and helper methods for IList<T>. More...


Source files:

Remarks

Extension methods and helper methods for IList<T>.

Extension methods that only apply to Loyc's new interfaces, or adapt a list to those interfaces, will go in LCExt instead.

The source code for adapter extension methods such as the Slice() method for arrays, which returns an ArraySlice<T> adapter, is now placed in the source file for each adapter class (e.g. ArraySlice.cs) to make it easier to create custom versions of Loyc.Essentials with parts removed.

Static Public Member Functions

static ArraySlice< T > Slice< T > (this T[] list, int start, int length=int.MaxValue)
 
static BufferedSequence< T > Buffered< T > (this IList< T > source)
 
static ListSlice< T > Slice< T > (this IList< T > list, int start, int length=int.MaxValue)
 
static ListSlice< T > Slice< T > (this IListAndListSource< T > list, int start, int length=int.MaxValue)
 
static T TryGet< T > (this IList< T > list, int index, T defaultValue)
 
static Maybe< T > TryGet< T > (this IList< T > list, int index)
 
static T TryGet< T > (this IListAndListSource< T > list, int index, T defaultValue)
 
static Maybe< T > TryGet< T > (this IListAndListSource< T > list, int index)
 
static int BinarySearch< T > (this IList< T > list, T value)
 
static int BinarySearch< T > (this IList< T > list, T value, IComparer< T > pred)
 
static int BinarySearch< T > (this IList< T > list, T find, Comparison< T > compare)
 
static int BinarySearch2< T, K > (this IList< T > list, K find, Func< T, K, int > compare, bool lowerBound=true)
 
static ? int FinalIndexWhere< T > (this IList< T > list, Func< T, bool > pred)
 Gets the highest index at which a condition is true, or null if nowhere. More...
 
static int LastIndexWhere< T > (this IList< T > list, Func< T, bool > pred)
 Gets the highest index at which a condition is true, or -1 if nowhere. More...
 
static ? int FinalIndexWhere< T > (this IListAndListSource< T > list, Func< T, bool > pred)
 Gets the highest index at which a condition is true, or null if nowhere. More...
 
static int LastIndexWhere< T > (this IListAndListSource< T > list, Func< T, bool > pred)
 Gets the highest index at which a condition is true, or -1 if nowhere. More...
 
static T[] Randomized< T > (this IList< T > list)
 Quickly makes a copy of a list, as an array, in random order. More...
 
static T[] Randomized< T > (this IListAndListSource< T > list)
 Quickly makes a copy of a list, as an array, in random order. More...
 

Member Function Documentation

◆ FinalIndexWhere< T >() [1/2]

static ? int Loyc.Collections.MutableListExtensionMethods.IListExt.FinalIndexWhere< T > ( this IList< T >  list,
Func< T, bool >  pred 
)
static

Gets the highest index at which a condition is true, or null if nowhere.

◆ FinalIndexWhere< T >() [2/2]

static ? int Loyc.Collections.MutableListExtensionMethods.IListExt.FinalIndexWhere< T > ( this IListAndListSource< T >  list,
Func< T, bool >  pred 
)
static

Gets the highest index at which a condition is true, or null if nowhere.

◆ LastIndexWhere< T >() [1/2]

static int Loyc.Collections.MutableListExtensionMethods.IListExt.LastIndexWhere< T > ( this IList< T >  list,
Func< T, bool >  pred 
)
static

Gets the highest index at which a condition is true, or -1 if nowhere.

◆ LastIndexWhere< T >() [2/2]

static int Loyc.Collections.MutableListExtensionMethods.IListExt.LastIndexWhere< T > ( this IListAndListSource< T >  list,
Func< T, bool >  pred 
)
static

Gets the highest index at which a condition is true, or -1 if nowhere.

◆ Randomized< T >() [1/2]

static T [] Loyc.Collections.MutableListExtensionMethods.IListExt.Randomized< T > ( this IList< T >  list)
inlinestatic

Quickly makes a copy of a list, as an array, in random order.

◆ Randomized< T >() [2/2]

static T [] Loyc.Collections.MutableListExtensionMethods.IListExt.Randomized< T > ( this IListAndListSource< T >  list)
inlinestatic

Quickly makes a copy of a list, as an array, in random order.