I don't believe you've understood what you were reading. First, IEnumerator
is an interface, which means that classes cannot derive from it (inherit
it), but implement it. Interfaces are "contracts" that specify what
properties and methods any class which implements that Interface must have.
A class can only inherit from one class, but it may implement many
Interfaces.
IEnumerator is an interface for creating classes that are used by other
classes to iterate through an aggregation of multiple instances of some
class. It contains definitions of one property (Current) and 2 methods
(MoveNext and Reset), which are used to move through an aggregation of class
instances.
I think you may be confusing IEnumerator and IEnumerable, which is another
Interface containing a single method (GetEnumerator), which returns an
instance of a class that implements the IEnumerator interface. Many
aggregate types, including Arrays and Collections of various types,
implement IEnumerator, to provide common mechanisms for navigation through
these aggregations.
System.Data.DataTable does not implement either of these Interfaces. It
does, however have a Rows property, which is a System.Data.DataRowCollection
of System.Data.DataRow instances. System.Data.DataRowCollection does not
implement IEnumerable directly, but inherits
System.Data.InternalDataCollectionBase, which implements IEnumerable (not
IEnumerator). Therefore, you CAN use the IEnumerable Interface in the Rows
property of a DataTable, to iterate through the Rows.
That' about as close as I can come to answering your question, as, put into
context, it doesn't really make much sense. That is, I am not sure what
you're asking, because you prefaced your question with erroneous
assumptions, and therefore I can't make out what exactly you want to do.
I can, however, give you a few references on IEnumerator, IEnumerable,
DataTable, DataRowCollection, and InternalDataCollectionBase:
http://msdn2.microsoft.com/en-us/lib...numerator.aspx http://msdn2.microsoft.com/en-us/lib...spx--HTH,Kevin SpencerMicrosoft MVPPrinting Components, Email Components,FTP Client Classes, Enhanced Data Controls, much more.DSI PrintManager, Miradyne Component Libraries:http://www.miradyne.net"EmilH" <em*****@yahoo.comwrote in messagenews:%2***************@TK2MSFTNGP05.phx.gbl ...Hi.>I have read some examples of IEnumerator athttp://www.codeproject.com/csharp/csenumerators.aspWhat if I have 2 arrays or collections, for example a DataSet which has 2DataTables in my class which derives from IEnumerator? How to implementCurrent property to return current item of the desired DataTable?>Thanks.Emil.>