Class SourceListEditConvenienceEx
- Namespace
- DynamicData
- Assembly
- DynamicData.dll
Convenience methods for a source list.
public static class SourceListEditConvenienceEx
- Inheritance
-
SourceListEditConvenienceEx
Methods
AddRange<T>(ISourceList<T>, IEnumerable<T>)
Adds the specified items to the source list.
public static void AddRange<T>(this ISourceList<T> source, IEnumerable<T> items) where T : notnull
Parameters
source
ISourceList<T>The source.
items
IEnumerable<T>The items.
Type Parameters
T
The item type.
Add<T>(ISourceList<T>, T)
Adds the specified item to the source list.
public static void Add<T>(this ISourceList<T> source, T item) where T : notnull
Parameters
source
ISourceList<T>The source list.
item
TThe item to add.
Type Parameters
T
The item type.
Clear<T>(ISourceList<T>)
Clears all items from the specified source list.
public static void Clear<T>(this ISourceList<T> source) where T : notnull
Parameters
source
ISourceList<T>The source to clear.
Type Parameters
T
The item type.
EditDiff<T>(ISourceList<T>, IEnumerable<T>, IEqualityComparer<T>?)
Loads the list with the specified items in an optimised manner i.e. calculates the differences between the old and new items in the list and amends only the differences.
public static void EditDiff<T>(this ISourceList<T> source, IEnumerable<T> allItems, IEqualityComparer<T>? equalityComparer = null) where T : notnull
Parameters
source
ISourceList<T>The source.
allItems
IEnumerable<T>The items to compare against and performing a delta.
equalityComparer
IEqualityComparer<T>The equality comparer used to determine whether an item has changed.
Type Parameters
T
The type of the object.
InsertRange<T>(ISourceList<T>, IEnumerable<T>, int)
Inserts the elements of a collection into the IExtendedList<T> at the specified index.
public static void InsertRange<T>(this ISourceList<T> source, IEnumerable<T> items, int index) where T : notnull
Parameters
source
ISourceList<T>The source.
items
IEnumerable<T>The items.
index
intThe zero-based index at which the new elements should be inserted.
Type Parameters
T
The item type.
Insert<T>(ISourceList<T>, int, T)
Adds the specified item to the source list.
public static void Insert<T>(this ISourceList<T> source, int index, T item) where T : notnull
Parameters
source
ISourceList<T>The source.
index
intThe index of the item.
item
TThe item.
Type Parameters
T
The item type.
Move<T>(ISourceList<T>, int, int)
Moves an item from the original to the destination index.
public static void Move<T>(this ISourceList<T> source, int original, int destination) where T : notnull
Parameters
source
ISourceList<T>The source.
original
intThe original.
destination
intThe destination.
Type Parameters
T
The item type.
RemoveAt<T>(ISourceList<T>, int)
Removes the element at the specified index.
public static void RemoveAt<T>(this ISourceList<T> source, int index) where T : notnull
Parameters
source
ISourceList<T>The source.
index
intThe index.
Type Parameters
T
The item type.
RemoveMany<T>(ISourceList<T>, IEnumerable<T>)
Removes the items from source in an optimised manner.
public static void RemoveMany<T>(this ISourceList<T> source, IEnumerable<T> itemsToRemove) where T : notnull
Parameters
source
ISourceList<T>The source.
itemsToRemove
IEnumerable<T>The items to remove.
Type Parameters
T
The item type.
RemoveRange<T>(ISourceList<T>, int, int)
Removes a range of elements from the ISourceList<T>.
public static void RemoveRange<T>(this ISourceList<T> source, int index, int count) where T : notnull
Parameters
source
ISourceList<T>The source.
index
intThe zero-based starting index of the range of elements to remove.
count
intThe number of elements to remove.
Type Parameters
T
The item type.
Exceptions
- ArgumentOutOfRangeException
index
is less than 0.-or-count
is less than 0.- ArgumentException
index
andcount
do not denote a valid range of elements in the List<T>.
Remove<T>(ISourceList<T>, T)
Removes the specified item from the source list.
public static bool Remove<T>(this ISourceList<T> source, T item) where T : notnull
Parameters
source
ISourceList<T>The source.
item
TThe item.
Returns
- bool
If the item was removed.
Type Parameters
T
The item type.
ReplaceAt<T>(ISourceList<T>, int, T)
Replaces the item at the specified index with the new item.
public static void ReplaceAt<T>(this ISourceList<T> source, int index, T item) where T : notnull
Parameters
source
ISourceList<T>The source.
index
intThe index.
item
TThe item.
Type Parameters
T
The item type.
Replace<T>(ISourceList<T>, T, T)
Replaces the specified original with the destination object.
public static void Replace<T>(this ISourceList<T> source, T original, T destination) where T : notnull
Parameters
source
ISourceList<T>The source.
original
TThe original.
destination
TThe destination.
Type Parameters
T
The item type.