Class ListExtensions
- Namespace
- Elegy.Common.Extensions
- Assembly
- Elegy.Common.dll
Elegy-specific List<T> extensions.
public static class ListExtensions
- Inheritance
-
ListExtensions
- Inherited Members
Methods
AddAndGet<T>(IList<T>, T)
public static T AddAndGet<T>(this IList<T> list, T element)
Parameters
list
IList<T>element
T
Returns
- T
Type Parameters
T
AddAndGet<T>(ISet<T>, T)
public static T AddAndGet<T>(this ISet<T> set, T element)
Parameters
set
ISet<T>element
T
Returns
- T
Type Parameters
T
AsSpan<T>(List<T>)
Sometimes AsSpan
is not available for lists, so we can always have this.
public static Span<T> AsSpan<T>(this List<T> list)
Parameters
list
List<T>
Returns
- Span<T>
Type Parameters
T
AsSpan<T>(List<T>, int)
public static Span<T> AsSpan<T>(this List<T> list, int start)
Parameters
Returns
- Span<T>
Type Parameters
T
AsSpan<T>(List<T>, int, int)
Interprets a List<T> as a Span<T> but starting from the start
'th element,
going up to length
elements after that.
public static Span<T> AsSpan<T>(this List<T> list, int start, int length)
Parameters
Returns
- Span<T>
Type Parameters
T
Random<T>(IList<T>)
public static T Random<T>(this IList<T> list)
Parameters
list
IList<T>
Returns
- T
Type Parameters
T
RemoveAndThen<T>(ISet<T>, T, Action<T>)
public static bool RemoveAndThen<T>(this ISet<T> set, T element, Action<T> onRemoved)
Parameters
Returns
Type Parameters
T
RingAdd<T>(IList<T>, T, int, int)
public static int RingAdd<T>(this IList<T> list, T element, int ringSize, int index)
Parameters
Returns
Type Parameters
T
RingAt<T>(IList<T>, int, int)
public static T RingAt<T>(this IList<T> list, int ringSize, int index)
Parameters
Returns
- T
Type Parameters
T
TryGetAt<T>(IList<T>, int)
public static T? TryGetAt<T>(this IList<T> list, int elementIndex)
Parameters
Returns
- T
Type Parameters
T
TryRemove<T>(IList<T>, int, Action<T>)
public static bool TryRemove<T>(this IList<T> list, int elementIndex, Action<T> onRemove)
Parameters
Returns
Type Parameters
T
TryRemove<T>(IList<T>, T, Action<T>)
public static bool TryRemove<T>(this IList<T> list, T element, Action<T> onRemove)
Parameters
Returns
Type Parameters
T