Edit

Share via


DbDataReader.GetEnumerator Method

Definition

When overridden in a derived class, returns an enumerator that can be used to iterate through the rows in the data reader.

public:
 abstract System::Collections::IEnumerator ^ GetEnumerator();
public abstract System.Collections.IEnumerator GetEnumerator ();
abstract member GetEnumerator : unit -> System.Collections.IEnumerator
Public MustOverride Function GetEnumerator () As IEnumerator

Returns

An enumerator that can be used to iterate through the rows in the data reader.

Implements

Remarks

Although you can use this method to retrieve an explicit constructor, in languages that support an explicit foreach construct, it is simpler to use the looping construct directly in order to iterate through the rows in the data reader.

If you implement this method, it should return a new instance of DbEnumerator or ensure that your enumerator returns IDataRecord objects.

Applies to

See also