Class XList
- Namespace
- Prefrontal.Common.Extensions
- Assembly
- Prefrontal.Core.dll
public static class XList
- Inheritance
-
XList
- Inherited Members
Methods
Extract<T>(List<T>, Func<T, bool>)
Extracts all elements from a list that satisfy a predicate. This method mutates the list.
public static List<T> Extract<T>(this List<T> list, Func<T, bool> predicate)
Parameters
list
List<T>The list to extract elements from.
predicate
Func<T, bool>The predicate to test elements against.
Returns
- List<T>
The elements that were removed.
Type Parameters
T
RemoveFirst<T>(IList<T>)
Removes the first element from the list and returns it or null if the list is empty.
public static T? RemoveFirst<T>(this IList<T> list) where T : class
Parameters
list
IList<T>The list whose first element to remove.
Returns
- T
The first element of the list, or null if the list is empty.
Type Parameters
T
The type of the elements in the list.
RemoveFirst<T>(List<T>)
Removes the first element from the list and returns it or null if the list is empty.
public static T? RemoveFirst<T>(this List<T> list) where T : struct
Parameters
list
List<T>The list whose first element to remove.
Returns
- T?
The first element of the list, or null if the list is empty.
Type Parameters
T
The type of the elements in the list.
RemoveLast<T>(IList<T>)
Removes the last element from the list and returns it or null if the list is empty.
public static T? RemoveLast<T>(this IList<T> list) where T : class
Parameters
list
IList<T>The list whose last element to remove.
Returns
- T
The last element of the list, or null if the list is empty.
Type Parameters
T
The type of the elements in the list.
RemoveLast<T>(List<T>)
Removes the last element from the list and returns it or null if the list is empty.
public static T? RemoveLast<T>(this List<T> list) where T : struct
Parameters
list
List<T>The list whose last element to remove.
Returns
- T?
The last element of the list, or null if the list is empty.
Type Parameters
T
The type of the elements in the list.