The <typeName> Type is not Supported by the For Each Statement

Description

A custom collection not supported by the For Each cycle is implemented in the code.

Troubleshooting Tips

If it is required to use the For Each cycle, implement a custom collection by inheriting from basic classes included into the Collection assembly, or use the For...End For cycle to work with the collection.

Example

Interface IMyItem
    Public Property Text: String
        Get
    End Property Text;
    Public Property Value: Variant
        Get
    End Property Value;
End Interface IMyItem;

Interface IMyItems
    Public Property Item(i: Integer): IMyItem
        Get
        Set
    End Property Item;

    Public Property Count: Integer
        Get
    End Property Count;
End Interface IMyItems;

Sub TestProc;
Var
    Arr: IMyItems;
    Obj: IMyItem;
    i: Integer;
Begin
    //
    For Each Obj In Arr Do
        
    End For;
    //
End Sub TestProc;

When the specified code is compiled, the string For Each Obj In Arr Do displays the following error: The IMyItems type is not supported by the For Each statement. To resolve the error, use the For...End For cycle, or implement the custom collection by inheriting from the classes included into the Assembly collection.

See also:

Compiler Messages