Tuesday, November 18, 2008

Using TInterfaceList with for in Syntax

In Delphi 2009 you may have notice that IInterfaceListEx has added to the list of interfaces supported by TInterfaceList:

TInterfaceList = class(TInterfacedObject, IInterfaceList, IInterfaceListEx)
For those of you who use interfaces this will be of interest but I've found that most people use the class directly rather than the interface. As it turns out we couldn't modify IInterfaceList because it would break a published interface, so we had to create a new interface to allow a developer using interfaces to use enumerators which are required for the for in syntax. So there you have it. If you like to use interfaces and you use IInterfaceList, you can now use the for in syntax.

No comments:

Post a Comment