Method SetCount
SetCount<T>(IList<T>, int, Func<T>)
Changes the number of elements in the list.
public static void SetCount<T>(IList<T> list, int newCount, Func<T> createItem)
Parameters
list
IList<T>List with items.
newCount
intNew number of elements.
createItem
Func<T>Function which creates new item.
Type Parameters
T
Remarks
If collection has more items than specified in newCount
,
these items are removed. If collection has less items, new items are created
using createItem
function.