Class CollectionExtensions
Holds extension methods for System.Collections.Generic.ICollection<>.
Inheritance
Namespace: Telerik.Windows.Controls
Assembly: Telerik.Windows.Controls.ScheduleView.dll
Syntax
public static class CollectionExtensions : Object
Methods
AddRange(IList, IEnumerable)
Adds the elements from the specified collection - items
to the end of the target list
.
Declaration
public static void AddRange(this IList list, IEnumerable items)
Parameters
System.Collections.IList
list
The list that will be extended. |
System.Collections.IEnumerable
items
The items that will be added. |
Exceptions
System.ArgumentNullException
|
AddRange(ItemCollection, IEnumerable)
Adds the elements from the specified collection - items
to the end of the target list
.
Declaration
public static void AddRange(this ItemCollection list, IEnumerable items)
Parameters
System.Windows.Controls.ItemCollection
list
The list that will be extended. |
System.Collections.IEnumerable
items
The items that will be added. |
Exceptions
System.ArgumentNullException
|
AddRange<T>(ICollection<T>, IEnumerable<T>)
Adds the elements from the specified collection - items
to the end of the target collection
.
Declaration
public static void AddRange<T>(this ICollection<T> collection, IEnumerable<T> items)
Parameters
System.Collections.Generic.ICollection<T>
collection
The collection that will be extended. |
System.Collections.Generic.IEnumerable<T>
items
The items that will be added. |
Type Parameters
T
|
Exceptions
System.ArgumentNullException
|
Append<T>(IEnumerable<T>, T)
Appends an element to a sequence.
Declaration
public static IEnumerable<T> Append<T>(this IEnumerable<T> source, T other)
Parameters
System.Collections.Generic.IEnumerable<T>
source
A sequence to return elements from. |
T
other
An element to be included in the sequence. |
Returns
System.Collections.Generic.IEnumerable<T>
An System.Collections.Generic.IEnumerable(T) that contains the elements from the input sequences and appends it with the other element. |
Type Parameters
T
The type of the elements. |
Append<T>(IEnumerable<T>, IEnumerable<T>)
Appends elements from two sequences.
Declaration
public static IEnumerable<T> Append<T>(this IEnumerable<T> source, IEnumerable<T> other)
Parameters
System.Collections.Generic.IEnumerable<T>
source
The first sequence. |
System.Collections.Generic.IEnumerable<T>
other
The second sequence. |
Returns
System.Collections.Generic.IEnumerable<T>
An System.Collections.Generic.IEnumerable(T) that contains the elements from both input sequences. |
Type Parameters
T
The type of the elements. |
RemoveAll(IList, Predicate<Object>)
Removes all elements from a list that match the condition defined by the specified predicate.
Declaration
public static int RemoveAll(this IList list, Predicate<object> match)
Parameters
System.Collections.IList
list
The list, which elements will be removed. |
System.Predicate<System.Object>
match
The predicate delegate that defines the condition for the removed elements. |
Returns
System.Int32
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
public static int RemoveAll<T>(this ICollection<T> collection, Predicate<T> match)
Parameters
System.Collections.Generic.ICollection<T>
collection
The collection, which elements will be removed. |
System.Predicate<T>
match
The predicate delegate that defines the condition for the removed elements. |
Returns
System.Int32
Number of removed elements. |
Type Parameters
T
Elements type. |
RemoveAll<T>(IList<T>)
Removes all elements from the given collection.
Declaration
public static void RemoveAll<T>(this IList<T> collection)
Parameters
System.Collections.Generic.IList<T>
collection
The collection, which will be emptied. |
Type Parameters
T
Elements type. |
TakeAfter<T>(IEnumerable<T>, Func<T, Boolean>)
Bypasses elements from a sequence as long as a specified condition is true and then returns the remaining elements.
Declaration
public static IEnumerable<T> TakeAfter<T>(this IEnumerable<T> target, Func<T, bool> predicate)
Parameters
System.Collections.Generic.IEnumerable<T>
target
A sequence to return elements from. |
System.Func<T, System.Boolean>
predicate
A function to test each element for a condition. |
Returns
System.Collections.Generic.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. |
Type Parameters
T
The type of the elements. |
TakeBefore<T>(IEnumerable<T>, Func<T, Boolean>)
Bypasses elements from a sequence until the specified condition becomes true.
Declaration
public static IEnumerable<T> TakeBefore<T>(this IEnumerable<T> target, Func<T, bool> predicate)
Parameters
System.Collections.Generic.IEnumerable<T>
target
A sequence to return elements from. |
System.Func<T, System.Boolean>
predicate
A function to test each element for a condition. |
Returns
System.Collections.Generic.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. |
Type Parameters
T
The type of the elements. |
TakeBetween<T>(IEnumerable<T>, T, T)
Returns elements from a sequence as long as they are between the two items.
Declaration
public static IEnumerable<T> TakeBetween<T>(this IEnumerable<T> target, T item1, T item2)
Parameters
System.Collections.Generic.IEnumerable<T>
target
A sequence to return elements from. |
T
item1
The first item. |
T
item2
The second item. |
Returns
System.Collections.Generic.IEnumerable<T>
An System.Collections.Generic.IEnumerable(T) that contains the elements between the two items including. |
Type Parameters
T
The type of the elements. |
TakeBetween<T>(IEnumerable<T>, Func<T, Boolean>, Func<T, Boolean>)
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
public static IEnumerable<T> TakeBetween<T>(this IEnumerable<T> target, Func<T, bool> predicate1, Func<T, bool> predicate2)
Parameters
System.Collections.Generic.IEnumerable<T>
target
A sequence to return elements from. |
System.Func<T, System.Boolean>
predicate1
A function to test each element for a condition. |
System.Func<T, System.Boolean>
predicate2
A function to test each element for a condition. |
Returns
System.Collections.Generic.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. |
Type Parameters
T
The type of the elements. |
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
public static IEnumerable<T> TakeFrom<T>(this IEnumerable<T> target, T item)
Parameters
System.Collections.Generic.IEnumerable<T>
target
A sequence to return elements from. |
T
item
An item to test each element. |
Returns
System.Collections.Generic.IEnumerable<T>
An System.Collections.Generic.IEnumerable(T) that contains the elements from the input sequence starting from the specified item including. |
Type Parameters
T
The type of the elements. |
TakeFrom<T>(IEnumerable<T>, Func<T, Boolean>)
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
public static IEnumerable<T> TakeFrom<T>(this IEnumerable<T> target, Func<T, bool> predicate)
Parameters
System.Collections.Generic.IEnumerable<T>
target
A sequence to return elements from. |
System.Func<T, System.Boolean>
predicate
A function to test each element for a condition. |
Returns
System.Collections.Generic.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. |
Type Parameters
T
The type of the elements. |
TakeTo<T>(IEnumerable<T>, T)
Returns elements from a sequence as long as the sequence elements differs from the item.
Declaration
public static IEnumerable<T> TakeTo<T>(this IEnumerable<T> target, T item)
Parameters
System.Collections.Generic.IEnumerable<T>
target
A sequence to return elements from. |
T
item
An item to test each element. |
Returns
System.Collections.Generic.IEnumerable<T>
An System.Collections.Generic.IEnumerable(T) that contains the elements from the input sequence that occur before the specified item including. |
Type Parameters
T
The type of the elements. |
TakeTo<T>(IEnumerable<T>, Func<T, Boolean>)
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
public static IEnumerable<T> TakeTo<T>(this IEnumerable<T> target, Func<T, bool> predicate)
Parameters
System.Collections.Generic.IEnumerable<T>
target
A sequence to return elements from. |
System.Func<T, System.Boolean>
predicate
A function to test each element for a condition. |
Returns
System.Collections.Generic.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. |
Type Parameters
T
The type of the elements. |
ToEnumerable<T>(T)
Converts the element to enumerable sequence.
Declaration
public static IEnumerable<T> ToEnumerable<T>(this T item)
Parameters
T
item
The element to convert to an enumerable sequence. |
Returns
System.Collections.Generic.IEnumerable<T>
The enumerable sequence containing the elements. |
Type Parameters
T
The type of the source. |