[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'db' (#fcl)

# TFieldsEnumerator

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Default enumerator for the fields collection of a dataset.

## Declaration

Source position: db.pas line 1050

`type TFieldsEnumerator = class`
`public`
`constructor Create();` |  | Create a new instance of TFieldsEnumerator.
`function MoveNext;` |  | Move the current field to the next field in the collection.
`property Current: TField; [r]` |  | Return the current field
`end;`

## Inheritance

`TFieldsEnumerator` |  | Default enumerator for the fields collection of a dataset.
`TObject`

## Description

TFieldsEnumerator implements all the methods of IEnumerator so a TFields instance can be used in a for..in construct. TFieldsEnumerator returns all the fields in the TFields collection. Therefor the following construct is possible:

    Var
      F : TField;

    begin
       // ...
       For F in MyDataset.Fields do
         begin
         // F is of type TField.
         end;
       // ...

Do not create an instance of TFieldsEnumerator manually. The compiler will do all that is needed when it encounters the for..in construct.

## See also

TField |  | Provide access to the contents of a single field in a record
TFields |  | Collection of #fcl.db.TField instances
#rtl.system.IEnumerator

The latest version of this document can be found at lazarus-ccr.sourceforge.net .