New to Telerik UI for WPFStart a free 30-day trial

Holds extension methods for ICollection<T>.

Definition

Namespace:Telerik.Windows.Controls

Assembly:Telerik.Windows.Controls.ScheduleView.dll

Syntax:

C#
public static class CollectionExtensions

Inheritance: objectCollectionExtensions

Methods

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

C#
public static void AddRange(this IList list, IEnumerable items)
Parameters:listIList

The list that will be extended.

itemsIEnumerable

The items that will be added.

Exceptions:

ArgumentNullException

items is null.

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

C#
public static void AddRange(this ItemCollection list, IEnumerable items)
Parameters:listItemCollection

The list that will be extended.

itemsIEnumerable

The items that will be added.

Exceptions:

ArgumentNullException

items is null.

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

C#
public static void AddRange<T>(this ICollection<T> collection, IEnumerable<T> items)
Parameters:collectionICollection<T>

The collection that will be extended.

itemsIEnumerable<T>

The items that will be added.

Exceptions:

ArgumentNullException

items is null.

Appends elements from two sequences.

C#
public static IEnumerable<T> Append<T>(this IEnumerable<T> source, IEnumerable<T> other)
Parameters:sourceIEnumerable<T>

The first sequence.

otherIEnumerable<T>

The second sequence.

Returns:

IEnumerable<T>

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

Appends an element to a sequence.

C#
public static IEnumerable<T> Append<T>(this IEnumerable<T> source, T other)
Parameters:sourceIEnumerable<T>

A sequence to return elements from.

otherT

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.

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

C#
public static int RemoveAll(this IList list, Predicate<object> match)
Parameters:listIList

The list, which elements will be removed.

matchPredicate<object>

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

Returns:

int

Number of the removed elements.

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

C#
public static int RemoveAll<T>(this ICollection<T> collection, Predicate<T> match)
Parameters:collectionICollection<T>

The collection, which elements will be removed.

matchPredicate<T>

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

Returns:

int

Number of removed elements.

Removes all elements from the given collection.

C#
public static void RemoveAll<T>(this IList<T> collection)
Parameters:collectionIList<T>

The collection, which will be emptied.

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

C#
public static IEnumerable<T> TakeAfter<T>(this IEnumerable<T> target, Func<T, bool> predicate)
Parameters:targetIEnumerable<T>

A sequence to return elements from.

predicateFunc<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.

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

C#
public static IEnumerable<T> TakeBefore<T>(this IEnumerable<T> target, Func<T, bool> predicate)
Parameters:targetIEnumerable<T>

A sequence to return elements from.

predicateFunc<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.

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.

C#
public static IEnumerable<T> TakeBetween<T>(this IEnumerable<T> target, Func<T, bool> predicate1, Func<T, bool> predicate2)
Parameters:targetIEnumerable<T>

A sequence to return elements from.

predicate1Func<T, bool>

A function to test each element for a condition.

predicate2Func<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.

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

C#
public static IEnumerable<T> TakeBetween<T>(this IEnumerable<T> target, T item1, T item2)
Parameters:targetIEnumerable<T>

A sequence to return elements from.

item1T

The first item.

item2T

The second item.

Returns:

IEnumerable<T>

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

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.

C#
public static IEnumerable<T> TakeFrom<T>(this IEnumerable<T> target, Func<T, bool> predicate)
Parameters:targetIEnumerable<T>

A sequence to return elements from.

predicateFunc<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.

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

C#
public static IEnumerable<T> TakeFrom<T>(this IEnumerable<T> target, T item)
Parameters:targetIEnumerable<T>

A sequence to return elements from.

itemT

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.

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

C#
public static IEnumerable<T> TakeTo<T>(this IEnumerable<T> target, Func<T, bool> predicate)
Parameters:targetIEnumerable<T>

A sequence to return elements from.

predicateFunc<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.

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

C#
public static IEnumerable<T> TakeTo<T>(this IEnumerable<T> target, T item)
Parameters:targetIEnumerable<T>

A sequence to return elements from.

itemT

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.

Converts the element to enumerable sequence.

C#
public static IEnumerable<T> ToEnumerable<T>(this T item)
Parameters:itemT

The element to convert to an enumerable sequence.

Returns:

IEnumerable<T>

The enumerable sequence containing the elements.