IEnumerable <System.Collections.Generic>

A collection interface that allows you to iterate over a sequence of elements.

Overview

The IEnumerable interface defines a standard way to iterate over a collection of items. It represents a sequence of elements that can be accessed in a specific order. This interface is part of the System.Collections.Generic namespace and is often used in conjunction with IEnumerator for more advanced iteration scenarios.

Methods

GetEnumerator()

Returns an IEnumerator that can be used to iterate over the elements in this sequence.

IEnumerator GetEnumerator()

CopyTo(T[] array, int arrayIndex)

Copies the elements of this sequence to an array.

CopyTo(T[] array, int arrayIndex)

Usage

IEnumerable is commonly used with other collection types like List, Array, and custom collection classes. It provides a standardized way to access and process elements without needing to know the underlying implementation details.

Related APIs