共用方式為


IEnumerable Interface

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Exposes the enumerator, which supports a simple iteration over a non-generic collection.

Namespace:  System.Collections
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<GuidAttribute("496B0ABE-CDEE-11d3-88E8-00902754C43A")> _
<ComVisibleAttribute(True)> _
Public Interface IEnumerable
[GuidAttribute("496B0ABE-CDEE-11d3-88E8-00902754C43A")]
[ComVisibleAttribute(true)]
public interface IEnumerable

The IEnumerable type exposes the following members.

Methods

  Name Description
Public methodSupported by Silverlight for Windows PhoneSupported by Xbox 360 GetEnumerator Returns an enumerator that iterates through a collection.

Top

Extension Methods

  Name Description
Public Extension MethodSupported by Silverlight for Windows Phone AsQueryable Converts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodSupported by Silverlight for Windows PhoneSupported by Xbox 360 Cast<TResult> Converts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodSupported by Silverlight for Windows PhoneSupported by Xbox 360 OfType<TResult> Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)

Top

Remarks

For the generic version of this interface see System.Collections.Generic.IEnumerable<T>.

Notes to Implementers

IEnumerable must be implemented to support the foreach semantics of Microsoft Visual Basic. COM classes that allow enumerators also implement this interface.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.