NanoByte.Common  2.6.1
NanoByte.Common.Collections.ListExtensions Class Reference

Provides extension methods for List<T>s. More...

Static Public Member Functions

static void AddRange< TList, TElements > (this List< TList > list, IEnumerable< TElements > elements)
 Adds multiple elements to the list. More...
 
static void RemoveLast< T > (this List< T > list, int number=1)
 Removes the last n elements from the list. More...
 
static bool AddOrReplace< T, TKey > (this List< T > list, T element, Func< T, TKey > keySelector)
 Adds or replaces an element in a list using a key selector for comparison. More...
 
static bool AddOrReplace< T > (this List< T > list, T element)
 Adds or replaces an element in a list. More...
 

Detailed Description

Provides extension methods for List<T>s.

Member Function Documentation

◆ AddOrReplace< T >()

static bool NanoByte.Common.Collections.ListExtensions.AddOrReplace< T > ( this List< T >  list,
element 
)
inlinestatic

Adds or replaces an element in a list.

Parameters
listThe list to update.
elementThe element to add or update.
Returns

◆ AddOrReplace< T, TKey >()

static bool NanoByte.Common.Collections.ListExtensions.AddOrReplace< T, TKey > ( this List< T >  list,
element,
Func< T, TKey >  keySelector 
)
inlinestatic

Adds or replaces an element in a list using a key selector for comparison.

Parameters
listThe list to update.
elementThe element to add or update.
keySelectorUsed to map elements to keys for comparison
Returns

◆ AddRange< TList, TElements >()

static void NanoByte.Common.Collections.ListExtensions.AddRange< TList, TElements > ( this List< TList >  list,
IEnumerable< TElements >  elements 
)
inlinestatic

Adds multiple elements to the list.

This is a covariant wrapper for List<T>.AddRange.

Type Constraints
TElements :TList 

◆ RemoveLast< T >()

static void NanoByte.Common.Collections.ListExtensions.RemoveLast< T > ( this List< T >  list,
int  number = 1 
)
inlinestatic

Removes the last n elements from the list.

Parameters
listThe list to remove the elements from.
numberThe number of elements to remove.

The documentation for this class was generated from the following file: