Various class extensions for generic collections.
More...
|
static void | AddElement< TKey, TValue, TCollection > (this IDictionary< TKey, TCollection > mutableLookup, TKey key, TValue value) |
| Adds an element to a mutable lookup table
(E.g. Dictionary<Key,List<Value>>) More...
|
|
static void | AddRange< T > (this IList< T > list, IEnumerable< T > values) |
| Adds a range of values to the specified IList. More...
|
|
static bool | ContainsElement< TKey, TValue, TCollection > (this IDictionary< TKey, TCollection > mutableLookup, TKey key, TValue value) |
| Queries if a certain value exists in a mutable lookup table
(E.g. Dictionary<Key,List<Value>>) More...
|
|
static void | DisposeAll (this IEnumerable< IDisposable?>? disposables) |
|
static int | InsertOrdered< T > (this List< T > sortedList, T item, IComparer< T >? comparer=null) |
| Inserts an item into an already sorted list. More...
|
|
static bool | RemoveElement< TKey, TValue, TCollection > (this IDictionary< TKey, TCollection > mutableLookup, TKey key, TValue value) |
| Removes an element from a mutable lookup table
(E.g. Dictionary<Key,List<Value>>) More...
|
|
static ? TValue | SafeGet< TKey, TValue > (this IDictionary< TKey, TValue > dictionary, TKey key) |
|
static IEnumerable< T > | SafeYield< T > (this T? item) |
| Wraps this object instance into an IEnumerable<T> consisting of a single item.
If the item is null, returns an empty enumerable instead. More...
|
|
static IEnumerable< T > | Yield< T > (this T item) |
| Wraps this object instance into an IEnumerable<T> consisting of a single item. More...
|
|
Various class extensions for generic collections.
◆ AddElement< TKey, TValue, TCollection >()
static void Anvil.API.CollectionExtensions.AddElement< TKey, TValue, TCollection > |
( |
this IDictionary< TKey, TCollection > |
mutableLookup, |
|
|
TKey |
key, |
|
|
TValue |
value |
|
) |
| |
|
inlinestatic |
Adds an element to a mutable lookup table
(E.g. Dictionary<Key,List<Value>>)
- Parameters
-
mutableLookup | The lookup to modify. |
key | The key that the element should be added to. |
value | The value that should be added. |
- Type Constraints
-
TCollection | : | ICollection<TValue> | |
TCollection | : | new() | |
◆ AddRange< T >()
static void Anvil.API.CollectionExtensions.AddRange< T > |
( |
this IList< T > |
list, |
|
|
IEnumerable< T > |
values |
|
) |
| |
|
inlinestatic |
Adds a range of values to the specified IList.
- Parameters
-
list | The list to update. |
values | The elements to add to the list. |
- Template Parameters
-
◆ ContainsElement< TKey, TValue, TCollection >()
static bool Anvil.API.CollectionExtensions.ContainsElement< TKey, TValue, TCollection > |
( |
this IDictionary< TKey, TCollection > |
mutableLookup, |
|
|
TKey |
key, |
|
|
TValue |
value |
|
) |
| |
|
inlinestatic |
Queries if a certain value exists in a mutable lookup table
(E.g. Dictionary<Key,List<Value>>)
- Parameters
-
mutableLookup | The lookup to query. |
key | The key to lookup. |
value | The value to be searched. |
- Type Constraints
-
TCollection | : | ICollection<TValue> | |
◆ InsertOrdered< T >()
static int Anvil.API.CollectionExtensions.InsertOrdered< T > |
( |
this List< T > |
sortedList, |
|
|
T |
item, |
|
|
IComparer< T >? |
comparer = null |
|
) |
| |
|
inlinestatic |
Inserts an item into an already sorted list.
- Parameters
-
sortedList | The sorted list. |
item | The item to insert. |
comparer | A custom comparer to use when comparing the item against elements in the collection. |
- Template Parameters
-
T | The type of item to insert. |
◆ RemoveElement< TKey, TValue, TCollection >()
static bool Anvil.API.CollectionExtensions.RemoveElement< TKey, TValue, TCollection > |
( |
this IDictionary< TKey, TCollection > |
mutableLookup, |
|
|
TKey |
key, |
|
|
TValue |
value |
|
) |
| |
|
inlinestatic |
Removes an element from a mutable lookup table
(E.g. Dictionary<Key,List<Value>>)
- Parameters
-
mutableLookup | The lookup to modify. |
key | The key that the element should be removed from. |
value | The value that should be removed. |
- Type Constraints
-
TCollection | : | ICollection<TValue> | |
TCollection | : | new() | |
◆ SafeYield< T >()
static IEnumerable<T> Anvil.API.CollectionExtensions.SafeYield< T > |
( |
this T? |
item | ) |
|
|
inlinestatic |
Wraps this object instance into an IEnumerable<T> consisting of a single item.
If the item is null, returns an empty enumerable instead.
- Template Parameters
-
- Parameters
-
item | The instance that will be wrapped. |
- Returns
- An IEnumerable<T> consisting of a single item.
◆ Yield< T >()
static IEnumerable<T> Anvil.API.CollectionExtensions.Yield< T > |
( |
this T |
item | ) |
|
|
inlinestatic |
Wraps this object instance into an IEnumerable<T> consisting of a single item.
- Template Parameters
-
- Parameters
-
item | The instance that will be wrapped. |
- Returns
- An IEnumerable<T> consisting of a single item.
The documentation for this class was generated from the following file:
- NWN.Anvil/src/main/API/Extensions/CollectionExtensions.cs