Interface IEnumerator

#### Search Results

Search

# Interface IEnumerator

This document covers the following topics:

- About IEnumerator

- Methods in IEnumerator

## About IEnumerator

This is the main interface of the component `SoftwareAG.NaturalX.Enumerator`. It is returned when a new instance of the component is created.

    define data
    local
    1 #enum handle of object
    end-define
    *
    * Create an instance of the class SoftwareAG.NaturalX.Enumerator.
    create object #enum of 'SoftwareAG.NaturalX.Enumerator.5'
    if #enum eq null-handle
      escape routine
    end-if
    *
    end

After successful execution of the `CREATE OBJECT` statement, the variable `#enum` contains an interface of the type `IEnumerator`.

## Methods in IEnumerator

The following methods are available:

- Attach

- Reset (IEnumerator)

- Next (IEnumerator)

### Attach

Attaches a collection to the enumerator. A previously attached collection is then automatically detached. After having attached a collection, the enumerator can be used to enumerate the items contained in that collection.

#### Parameters

Name | Natural Type | Variant Type | Remark
--- | --- | --- | ---
Collection | HANDLE OF OBJECT | VT_DISPATCH | By value

> Collection

>   A collection of Automation objects.

### Reset (IEnumerator)

Resets the enumerator to its initial state. A subsequent call to the method `Next` returns the first item in the collection.

### Next (IEnumerator)

Returns the next item in the collection. If there is no next item, `NULL-HANDLE` is returned. To start the enumeration over, the method `Reset` can be called.

#### Parameters

Name | Natural Type | Variant Type | Remark
--- | --- | --- | ---
Return value | HANDLE OF OBJECT | VT_DISPATCH |

> Return value

>   An interface to the next item in the collection.

### On this page

- About IEnumerator
- Methods in IEnumerator