Extensions for the generic List<T> object.
More...
|
static void | SelectiveUpdate< T > (this List< T > l, IEnumerable< T > other) |
| Similar to List<T>.AddRange(IEnumerable<T>), but designed for unique elements.
Removes elements from l that are not present in other .
Adds elements from other to l that aren't already present somewhere in the list.
More...
|
|
static IList< T > | ForEach< T > (this IList< T > list, Action< T > action) |
|
static IList | ForEach (this IList list, Action< object?> action) |
|
static void | AddRange (this IList list, IEnumerable enumerable) |
| Adds a range of items to the list . More...
|
|
static void | AddIfUnique (this IList list, object obj) |
| Adds obj to the list if it isn't a duplicate of any existing elements. More...
|
|
static void | AddRangeIfUnique (this IList list, IEnumerable range) |
| Calls AddIfUnique(IList, object) on the given range of objects. More...
|
|
static TList | ConvertEach< TList, TOut, TIn > (this IEnumerable< TIn > enumerable, Func< TIn, TOut > converter) |
| Converts each element in the given enumerable from type TIn to type TOut , and returns the converted objects as a new list of type TList . More...
|
|
static IList< TOut > | ConvertEach< TOut, TIn > (this IEnumerable< TIn > enumerable, Func< TIn, TOut > converter) |
| Converts each element in the given enumerable from type TIn to type TOut , and returns the converted objects as a new List<T>. More...
|
|
static bool | IndexOf< T > (this IList< T > list, T item, out int index) |
| Gets the index of the first occurrence of item in this list . More...
|
|
Extensions for the generic List<T> object.
◆ AddIfUnique()
static void VolumeControl.TypeExtensions.ListExtensions.AddIfUnique |
( |
this IList |
list, |
|
|
object |
obj |
|
) |
| |
|
static |
Adds obj to the list if it isn't a duplicate of any existing elements.
- Parameters
-
list | List |
obj | Object to add to the list. The object is only added if it isn't a duplicate of an existing element, as determined by object.Equals(object?). |
◆ AddRange()
static void VolumeControl.TypeExtensions.ListExtensions.AddRange |
( |
this IList |
list, |
|
|
IEnumerable |
enumerable |
|
) |
| |
|
static |
Adds a range of items to the list .
- Parameters
-
list | (implicit) The list to add the items to. |
enumerable | An IEnumerable of items to add. |
◆ AddRangeIfUnique()
static void VolumeControl.TypeExtensions.ListExtensions.AddRangeIfUnique |
( |
this IList |
list, |
|
|
IEnumerable |
range |
|
) |
| |
|
static |
Calls AddIfUnique(IList, object) on the given range of objects.
- Parameters
-
list | List |
range | A range of objects to add to the list. Each object is only added if it isn't a duplicate of an existing element, as determined by object.Equals(object?). |
◆ ConvertEach< TList, TOut, TIn >()
static TList VolumeControl.TypeExtensions.ListExtensions.ConvertEach< TList, TOut, TIn > |
( |
this IEnumerable< TIn > |
enumerable, |
|
|
Func< TIn, TOut > |
converter |
|
) |
| |
|
static |
Converts each element in the given enumerable from type TIn to type TOut , and returns the converted objects as a new list of type TList .
- Template Parameters
-
TList | The type of list to return. |
TOut | The type to convert each item to. |
TIn | The type to convert each item from. |
- Parameters
-
enumerable | Any type implementing IEnumerable<T>. |
converter | A converter method that accepts TIn and returns TOut . |
- Returns
- The converted list of items.
- Type Constraints
-
TList | : | IList | |
TList | : | IEnumerable | |
TList | : | IList<TOut> | |
TList | : | IEnumerable<TOut> | |
TList | : | ICollection | |
TList | : | ICollection<TOut> | |
TList | : | new() | |
◆ ConvertEach< TOut, TIn >()
static IList<TOut> VolumeControl.TypeExtensions.ListExtensions.ConvertEach< TOut, TIn > |
( |
this IEnumerable< TIn > |
enumerable, |
|
|
Func< TIn, TOut > |
converter |
|
) |
| |
|
static |
Converts each element in the given enumerable from type TIn to type TOut , and returns the converted objects as a new List<T>.
- Template Parameters
-
TOut | The type to convert each item to. |
TIn | The type to convert each item from. |
- Parameters
-
enumerable | Any type implementing IEnumerable<T>. |
converter | A converter method that accepts TIn and returns TOut . |
- Returns
- The converted list of items.
◆ ForEach()
static IList VolumeControl.TypeExtensions.ListExtensions.ForEach |
( |
this IList |
list, |
|
|
Action< object?> |
action |
|
) |
| |
|
static |
- Returns
- The resulting list ; this can safely be ignored when using this method outside of a pipeline.
◆ ForEach< T >()
- Returns
- The resulting list ; this can safely be ignored when using this method outside of a pipeline.
◆ IndexOf< T >()
static bool VolumeControl.TypeExtensions.ListExtensions.IndexOf< T > |
( |
this IList< T > |
list, |
|
|
T |
item, |
|
|
out int |
index |
|
) |
| |
|
static |
Gets the index of the first occurrence of item in this list .
- Template Parameters
-
T | The type of object in the IList<T>. |
- Parameters
-
list | (implicit) The IList<T> to search. |
item | The object to locate in the IList<T>. |
index | The index of item if found in the list; otherwise -1. |
- Returns
true
when item was found in the list; otherwise false
.
◆ SelectiveUpdate< T >()
static void VolumeControl.TypeExtensions.ListExtensions.SelectiveUpdate< T > |
( |
this List< T > |
l, |
|
|
IEnumerable< T > |
other |
|
) |
| |
|
static |
Similar to List<T>.AddRange(IEnumerable<T>), but designed for unique elements.
Removes elements from l that are not present in other .
Adds elements from other to l that aren't already present somewhere in the list.
- Template Parameters
-
- Parameters
-
l | The generic list on which to operate. |
other | Any enumerable list of type T . |
The documentation for this class was generated from the following file:
- /home/runner/work/volume-control/volume-control/VolumeControl.TypeExtensions/ListExtensions.cs