ListExtensions Type

Supports movement of selected items up/down in a list.

Static members

Static member Description

ListExtensions.AddRange(collection, itemsToAdd)

Full Usage: ListExtensions.AddRange(collection, itemsToAdd)

Parameters:

collection : ObservableCollection<'T>
itemsToAdd : IEnumerable<'T>

ListExtensions.AddRange(destination, itemsToAdd)

Full Usage: ListExtensions.AddRange(destination, itemsToAdd)

Parameters:
    destination : ICollection<'T> - The collection where to add the items.
    itemsToAdd : IEnumerable<'T> - The items to add.

Adds a range of items to a collection.

destination : ICollection<'T>

The collection where to add the items.

itemsToAdd : IEnumerable<'T>

The items to add.

ListExtensions.ExchangePositions(list, i, j)

Full Usage: ListExtensions.ExchangePositions(list, i, j)

Parameters:
    list : IList<'T> - List to operate with.
    i : int - Position of the first item.
    j : int - Position of the second item.

Exchange the positions of two items in a list.

list : IList<'T>

List to operate with.

i : int

Position of the first item.

j : int

Position of the second item.

ListExtensions.FillWith(collection, itemsToAdd)

Full Usage: ListExtensions.FillWith(collection, itemsToAdd)

Parameters:

collection : ObservableCollection<'T>
itemsToAdd : IEnumerable<'T>

ListExtensions.FillWith(collection, itemsToAdd)

Full Usage: ListExtensions.FillWith(collection, itemsToAdd)

Parameters:

collection : ICollection<'T>
itemsToAdd : IEnumerable<'T>

ListExtensions.GetPossibleStepsToMoveTowardsHigherIndices(list, IsSelected)

Full Usage: ListExtensions.GetPossibleStepsToMoveTowardsHigherIndices(list, IsSelected)

Parameters:
    list : IReadOnlyList<'T> - List to operate onto.
    IsSelected : Func<int, bool> - Function that determines for each item index if it is selected or not.

Returns: int The number of steps that all selected items can be moved towards higher indices, so that the selected item with the highest index is moved to the end of the list (at index list.Count-1).

Return the number of steps that selected items can be moved towards higher indices. The selected item with the highest index determines that value.

list : IReadOnlyList<'T>

List to operate onto.

IsSelected : Func<int, bool>

Function that determines for each item index if it is selected or not.

Returns: int

The number of steps that all selected items can be moved towards higher indices, so that the selected item with the highest index is moved to the end of the list (at index list.Count-1).

ListExtensions.GetPossibleStepsToMoveTowardsLowerIndices(list, IsSelected)

Full Usage: ListExtensions.GetPossibleStepsToMoveTowardsLowerIndices(list, IsSelected)

Parameters:
    list : IReadOnlyList<'T> - List to operate onto.
    IsSelected : Func<int, bool> - Function that determines for each item index if it is selected or not.

Returns: int The number of steps that all selected items can be moved towards lower indices, so that the selected item with the lowest index is moved to index 0.

Return the number of steps that selected items can be moved towards lower indices. The selected item with the lowest index determines that value.

list : IReadOnlyList<'T>

List to operate onto.

IsSelected : Func<int, bool>

Function that determines for each item index if it is selected or not.

Returns: int

The number of steps that all selected items can be moved towards lower indices, so that the selected item with the lowest index is moved to index 0.

ListExtensions.IndexOf(list, searchedItem)

Full Usage: ListExtensions.IndexOf(list, searchedItem)

Parameters:
    list : IEnumerable<'T> - The item list.
    searchedItem : 'T - The searched item.

Returns: int Index of the first occurence of the searched item in the list (0 for the first item). If the item is not found in the list, a negative value is returned.

Gets the index of an item in a enumeration or list.

list : IEnumerable<'T>

The item list.

searchedItem : 'T

The searched item.

Returns: int

Index of the first occurence of the searched item in the list (0 for the first item). If the item is not found in the list, a negative value is returned.

ListExtensions.IndexOfFirst(list, predicate)

Full Usage: ListExtensions.IndexOfFirst(list, predicate)

Parameters:
    list : IEnumerable<'T> - The list.
    predicate : Func<'T, bool> - The predicate function. The first argument is the item. If the return value is true, the index of this item is returned.

Returns: int Index the of first item in list that fulfills the predicate, or a value of -1 if no such item could be found.

Gets the index the of first item in list that fulfills the predicate predicate

list : IEnumerable<'T>

The list.

predicate : Func<'T, bool>

The predicate function. The first argument is the item. If the return value is true, the index of this item is returned.

Returns: int

Index the of first item in list that fulfills the predicate, or a value of -1 if no such item could be found.

ListExtensions.IndexOfFirst(list, predicate)

Full Usage: ListExtensions.IndexOfFirst(list, predicate)

Parameters:
    list : IEnumerable<'T> - The list.
    predicate : Func<'T, int, bool> - The predicate function. The first argument is the item, the second argument is the item's index in the enumeration. If the return value is true, the index of this item is returned.

Returns: int Index the of first item in list that fulfills the predicate, or a value of -1 if no such item could be found.

Gets the index the of first item in list that fulfills the predicate predicate

list : IEnumerable<'T>

The list.

predicate : Func<'T, int, bool>

The predicate function. The first argument is the item, the second argument is the item's index in the enumeration. If the return value is true, the index of this item is returned.

Returns: int

Index the of first item in list that fulfills the predicate, or a value of -1 if no such item could be found.

ListExtensions.IndexOfLast(list, predicate)

Full Usage: ListExtensions.IndexOfLast(list, predicate)

Parameters:
    list : IList<'T> - The list.
    predicate : Func<'T, int, bool> - The predicate function. The first argument is the item, the second argument is the item's index in the list. If the return value is true, the index of this item is returned.

Returns: int Index the of last item in list that fulfills the predicate, or a value of -1 if no such an item could be found.

Gets the index the of last item in list that fulfills the predicate predicate

list : IList<'T>

The list.

predicate : Func<'T, int, bool>

The predicate function. The first argument is the item, the second argument is the item's index in the list. If the return value is true, the index of this item is returned.

Returns: int

Index the of last item in list that fulfills the predicate, or a value of -1 if no such an item could be found.

ListExtensions.MoveItemToIndex(list, originalIndex, destinationIndex)

Full Usage: ListExtensions.MoveItemToIndex(list, originalIndex, destinationIndex)

Parameters:
    list : IList<'T> - List to operate with.
    originalIndex : int - Original position of the item.
    destinationIndex : int - Destination position of the item.

Moves a item to another list position. All items inbetween the interval originalIndex and destinationIndex will slip by one position (except the item at originalIndex, which will of course move to destinationIndex.

list : IList<'T>

List to operate with.

originalIndex : int

Original position of the item.

destinationIndex : int

Destination position of the item.

ListExtensions.MoveSelectedItems(list, IsSelected, steps)

Full Usage: ListExtensions.MoveSelectedItems(list, IsSelected, steps)

Parameters:
    list : IList<'T> - List to operate with.
    IsSelected : Func<int, bool> - Function that determines for each item index if it is selected or not.
    steps : int - Number of steps to move. A positive value moves the items towards higher indices, a negative value towards lower indices.

Moves the selected items towards higher indices (for steps > 0) or lower indices (for steps < 0).

list : IList<'T>

List to operate with.

IsSelected : Func<int, bool>

Function that determines for each item index if it is selected or not.

steps : int

Number of steps to move. A positive value moves the items towards higher indices, a negative value towards lower indices.

ListExtensions.MoveSelectedItemsToMaximumIndex(list, IsSelected)

Full Usage: ListExtensions.MoveSelectedItemsToMaximumIndex(list, IsSelected)

Parameters:
    list : IList<'T> - List to operate with.
    IsSelected : Func<int, bool> - Function that determines for each item index if it is selected or not.

Moves the selected item so that the selected item with the formerly highest index is afterwards at the end of the list (at index list.Count-1).

list : IList<'T>

List to operate with.

IsSelected : Func<int, bool>

Function that determines for each item index if it is selected or not.

ListExtensions.MoveSelectedItemsToMinimumIndex(list, IsSelected)

Full Usage: ListExtensions.MoveSelectedItemsToMinimumIndex(list, IsSelected)

Parameters:
    list : IList<'T> - List to operate with.
    IsSelected : Func<int, bool> - Function that determines for each item index if it is selected or not.

Moves the selected item so that the selected item with the formerly lowest index is afterwards at the start of the list (at index 0).

list : IList<'T>

List to operate with.

IsSelected : Func<int, bool>

Function that determines for each item index if it is selected or not.

ListExtensions.MoveSelectedItemsTowardsHigherIndices(list, isSelected, steps)

Full Usage: ListExtensions.MoveSelectedItemsTowardsHigherIndices(list, isSelected, steps)

Parameters:
    list : IList<'T> - List to operate with.
    isSelected : Func<int, bool> - Function that determines for each item index if it is selected or not.
    steps : int - Number of steps to move. Has to be a positive value.

Moves the selected items towards higher indices.

list : IList<'T>

List to operate with.

isSelected : Func<int, bool>

Function that determines for each item index if it is selected or not.

steps : int

Number of steps to move. Has to be a positive value.

ListExtensions.MoveSelectedItemsTowardsLowerIndices(list, isSelected, steps)

Full Usage: ListExtensions.MoveSelectedItemsTowardsLowerIndices(list, isSelected, steps)

Parameters:
    list : IList<'T> - List to operate with.
    isSelected : Func<int, bool> - Function that determines for each item index if it is selected or not.
    steps : int - Number of steps to move. Has to be a positive value.

Moves the selected items towards lower indices.

list : IList<'T>

List to operate with.

isSelected : Func<int, bool>

Function that determines for each item index if it is selected or not.

steps : int

Number of steps to move. Has to be a positive value.

ListExtensions.RemoveWhere(list, predicate)

Full Usage: ListExtensions.RemoveWhere(list, predicate)

Parameters:
    list : IList<'T> - The list.
    predicate : Func<'T, bool> - The predicate function. The first argument is the item. If the function returns true, the item is removed from the list.

Removes all items for which the predicate function returns true.

The list is iterated backwards, starting from the last item in the list, and ending with the first item in the list.

list : IList<'T>

The list.

predicate : Func<'T, bool>

The predicate function. The first argument is the item. If the function returns true, the item is removed from the list.

ListExtensions.RemoveWhere(list, predicate)

Full Usage: ListExtensions.RemoveWhere(list, predicate)

Parameters:
    list : IList<'T> - The list.
    predicate : Func<'T, int, bool> - The predicate function. The first argument is the item, the second argument is the item's index. If the function returns true, the item is removed from the list.

Removes all items for which the predicate function returns true.

The list is iterated backwards, starting from the last item in the list, and ending with the first item in the list.

list : IList<'T>

The list.

predicate : Func<'T, int, bool>

The predicate function. The first argument is the item, the second argument is the item's index. If the function returns true, the item is removed from the list.