Class
CollectionExtensions

Holds extension methods for ICollection<T>.

Definition

Namespace:Telerik.Windows.Controls

Assembly:Telerik.Windows.Controls.ScheduleView.dll

Syntax:

cs-api-definition
public static class CollectionExtensions

Inheritance: objectCollectionExtensions

Methods

AddRange(IList, IEnumerable)

Adds the elements from the specified collection - items to the end of the target list.

Declaration

cs-api-definition
public static void AddRange(this IList list, IEnumerable items)

Parameters

list

IList

The list that will be extended.

items

IEnumerable

The items that will be added.

Exceptions

ArgumentNullException

items is null.

AddRange(ItemCollection, IEnumerable)

Adds the elements from the specified collection - items to the end of the target list.

Declaration

cs-api-definition
public static void AddRange(this ItemCollection list, IEnumerable items)

Parameters

list

ItemCollection

The list that will be extended.

items

IEnumerable

The items that will be added.

Exceptions

ArgumentNullException

items is null.

AddRange<T>(ICollection<T>, IEnumerable<T>)

Adds the elements from the specified collection - items to the end of the target collection.

Declaration

cs-api-definition
public static void AddRange<T>(this ICollection<T> collection, IEnumerable<T> items)

Parameters

collection

ICollection<T>

The collection that will be extended.

items

IEnumerable<T>

The items that will be added.

Exceptions

ArgumentNullException

items is null.

Append<T>(IEnumerable<T>, IEnumerable<T>)

Appends elements from two sequences.

Declaration

cs-api-definition
public static IEnumerable<T> Append<T>(this IEnumerable<T> source, IEnumerable<T> other)

Parameters

source

IEnumerable<T>

The first sequence.

other

IEnumerable<T>

The second sequence.

Returns

IEnumerable<T>

An System.Collections.Generic.IEnumerable(T) that contains the elements from both input sequences.

Append<T>(IEnumerable<T>, T)

Appends an element to a sequence.

Declaration

cs-api-definition
public static IEnumerable<T> Append<T>(this IEnumerable<T> source, T other)

Parameters

source

IEnumerable<T>

A sequence to return elements from.

other

T

An element to be included in the sequence.

Returns

IEnumerable<T>

An System.Collections.Generic.IEnumerable(T) that contains the elements from the input sequences and appends it with the other element.

RemoveAll(IList, Predicate<object>)

Removes all elements from a list that match the condition defined by the specified predicate.

Declaration

cs-api-definition
public static int RemoveAll(this IList list, Predicate<object> match)

Parameters

list

IList

The list, which elements will be removed.

match

Predicate<object>

The predicate delegate that defines the condition for the removed elements.

Returns

int

Number of the removed elements.

RemoveAll<T>(ICollection<T>, Predicate<T>)

Removes all elements from a collection that match the condition defined by the specified predicate.

Declaration

cs-api-definition
public static int RemoveAll<T>(this ICollection<T> collection, Predicate<T> match)

Parameters

collection

ICollection<T>

The collection, which elements will be removed.

match

Predicate<T>

The predicate delegate that defines the condition for the removed elements.

Returns

int

Number of removed elements.

RemoveAll<T>(IList<T>)

Removes all elements from the given collection.

Declaration

cs-api-definition
public static void RemoveAll<T>(this IList<T> collection)

Parameters

collection

IList<T>

The collection, which will be emptied.

TakeAfter<T>(IEnumerable<T>, Func<T, bool>)

Bypasses elements from a sequence as long as a specified condition is true and then returns the remaining elements.

Declaration

cs-api-definition
public static IEnumerable<T> TakeAfter<T>(this IEnumerable<T> target, Func<T, bool> predicate)

Parameters

target

IEnumerable<T>

A sequence to return elements from.

predicate

Func<T, bool>

A function to test each element for a condition.

Returns

IEnumerable<T>

An System.Collections.Generic.IEnumerable(T) that contains the elements from the input sequence that occur after the element at which the test no longer passes.

TakeBefore<T>(IEnumerable<T>, Func<T, bool>)

Bypasses elements from a sequence until the specified condition becomes true.

Declaration

cs-api-definition
public static IEnumerable<T> TakeBefore<T>(this IEnumerable<T> target, Func<T, bool> predicate)

Parameters

target

IEnumerable<T>

A sequence to return elements from.

predicate

Func<T, bool>

A function to test each element for a condition.

Returns

IEnumerable<T>

An System.Collections.Generic.IEnumerable(T) that contains the elements from the input sequence that occur before the element at which the test no longer passes.

TakeBetween<T>(IEnumerable<T>, Func<T, bool>, Func<T, bool>)

Bypasses elements from a sequence as long as the first condition is false. Returns elements from the remaining elements as long the second condition is false.

Declaration

cs-api-definition
public static IEnumerable<T> TakeBetween<T>(this IEnumerable<T> target, Func<T, bool> predicate1, Func<T, bool> predicate2)

Parameters

target

IEnumerable<T>

A sequence to return elements from.

predicate1

Func<T, bool>

A function to test each element for a condition.

predicate2

Func<T, bool>

A function to test each element for a condition.

Returns

IEnumerable<T>

An System.Collections.Generic.IEnumerable(T) that contains the elements from the input sequence that are between the elements that pass the test specified by the predicates.

TakeBetween<T>(IEnumerable<T>, T, T)

Returns elements from a sequence as long as they are between the two items.

Declaration

cs-api-definition
public static IEnumerable<T> TakeBetween<T>(this IEnumerable<T> target, T item1, T item2)

Parameters

target

IEnumerable<T>

A sequence to return elements from.

item1

T

The first item.

item2

T

The second item.

Returns

IEnumerable<T>

An System.Collections.Generic.IEnumerable(T) that contains the elements between the two items including.

TakeFrom<T>(IEnumerable<T>, Func<T, bool>)

Bypasses elements from a sequence as long as a specified condition is false and then returns the element that satisfies the condition and the elements after.

Declaration

cs-api-definition
public static IEnumerable<T> TakeFrom<T>(this IEnumerable<T> target, Func<T, bool> predicate)

Parameters

target

IEnumerable<T>

A sequence to return elements from.

predicate

Func<T, bool>

A function to test each element for a condition.

Returns

IEnumerable<T>

An System.Collections.Generic.IEnumerable(T) that contains the elements from the input sequence starting at the last element in the linear series that does not pass the test specified by predicate.

TakeFrom<T>(IEnumerable<T>, T)

Bypasses elements from a sequence as long as the element is not equal to the items in the sequence.

Declaration

cs-api-definition
public static IEnumerable<T> TakeFrom<T>(this IEnumerable<T> target, T item)

Parameters

target

IEnumerable<T>

A sequence to return elements from.

item

T

An item to test each element.

Returns

IEnumerable<T>

An System.Collections.Generic.IEnumerable(T) that contains the elements from the input sequence starting from the specified item including.

TakeTo<T>(IEnumerable<T>, Func<T, bool>)

Returns elements from a sequence as long as a specified condition is false. This method also returns the first element that satisfies the condition.

Declaration

cs-api-definition
public static IEnumerable<T> TakeTo<T>(this IEnumerable<T> target, Func<T, bool> predicate)

Parameters

target

IEnumerable<T>

A sequence to return elements from.

predicate

Func<T, bool>

A function to test each element for a condition.

Returns

IEnumerable<T>

An System.Collections.Generic.IEnumerable(T) that contains the elements from the input sequence that occur before the element at which the test no longer passes.

TakeTo<T>(IEnumerable<T>, T)

Returns elements from a sequence as long as the sequence elements differs from the item.

Declaration

cs-api-definition
public static IEnumerable<T> TakeTo<T>(this IEnumerable<T> target, T item)

Parameters

target

IEnumerable<T>

A sequence to return elements from.

item

T

An item to test each element.

Returns

IEnumerable<T>

An System.Collections.Generic.IEnumerable(T) that contains the elements from the input sequence that occur before the specified item including.

ToEnumerable<T>(T)

Converts the element to enumerable sequence.

Declaration

cs-api-definition
public static IEnumerable<T> ToEnumerable<T>(this T item)

Parameters

item

T

The element to convert to an enumerable sequence.

Returns

IEnumerable<T>

The enumerable sequence containing the elements.