skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop
    Web
    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for ASP.NET AJAX UI for ASP.NET MVC UI for ASP.NET Core UI for Blazor UI for Silverlight UI for PHP UI for JSP
    Mobile
    UI for .NET MAUI UI for Xamarin
    Document Management
    Telerik Document Processing
    Desktop
    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF UI for UWP
    Reporting & Mocking
    Telerik Reporting Telerik Report Server Telerik JustMock
    Automated Testing
    Test Studio Test Studio Dev Edition
    CMS
    Sitefinity
    UI/UX Tools
    ThemeBuilder
    Debugging
    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Jam FiddlerCap FiddlerCore
    Extended Reality
    UI for Unity XR
    Free Tools
    JustAssembly JustDecompile VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Docs & Support
  • Pricing
  • Search
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now

Class CollectionExtensions

Holds extension methods for System.Collections.Generic.ICollection<T>.

Inheritance
System.Object
CollectionExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Telerik.Windows.Controls
Assembly: Telerik.Windows.Controls.ScheduleView.dll

Syntax

public static class CollectionExtensions

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

items is null.

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

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

items is null.

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.

Was this article helpful?

Tell us how we can improve this article

Skip
Getting Started
  • Install Now
  • Demos
  • SDK Samples Browser
  • Sample Applications
Support Resources
  • Code Library
  • Knowledge Base
  • MVVM Support
  • Videos
  • GitHub SDK Repository
Community
  • Forums
  • Blogs
  • XAML Feedback Portal
  • Document Processing Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.