[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
Enumerator support interface.
Source position: objpash.inc line 328
type IEnumerator = interface(IInterface) |
||
function GetCurrent; |
|
Returns the current element in the iteration cycle. |
function MoveNext; |
|
Move to the next value. |
procedure Reset; |
|
Reset the pointer. |
|
Return the current item. |
|
end; |
|
Enumerator support interface. |
|
| | ||
|
Basic interface for all COM-based interfaces. |
|
| | ||
|
Basic interface for all COM based interfaces. |
IEnumerator is the interface needed by the For ... in ... language construct, when operating on classes. It contains all methods that the compiler needs to implement a loop.
A for in loop like the following:
or in MyObject do begin // do things end;
is treated by the compiler as equivalent to the following code:
Var I : IEnumerator; O : Objectnitinstance.html begin I:=MyObject.GetEnumerator; While I.MoveNext do begin O:=I.GetCurrent; // Do things end; end.
Any class that implements the IEnumerable interface must be able to return an IEnumerator instance for the compiler to use in a For in loop.
|
Interface to retrieve an enumerator from a class. |