Working with Collections

There are two different types of collections in ABBYY FlexiCapture SDK.

The first one represents a collection of references to existing objects. Usually such collections are used to pass various sets of parameters into methods that require them. You create this collection, add elements to it (elements are added as references to existing objects), pass to the required method, and then destroy the collection, while the objects that were added to it remain. Such collections have Collection postfix in their names (e.g. StringsCollection, IntsCollection, SectionDefinitionsCollection).

Another type represents a collection of child objects of some parent object. These collections exist while their parent object exists. Via such collections you can add or remove child objects of the parent object. When you add an element into the collection, a new object is created internally and then added to the collection. Examples of such collections: SectionDefinitions — a collection of section definitions, Pages — a collection of document pages.

Each ABBYY FlexiCapture SDK collection has the Count and Element properties and the Item method. The first one gets the number of elements actually contained in the collection, the second and third ones get the element at the specified index. The Element property allows you to access an element of the collection using the [] operator in C#. The other properties and methods are specific for the collection.

Important! The indexing of ABBYY FlexiCapture SDK collections starts with 0.

Below is an example of using the StringsCollection and IntsCollection objects in C++:

C# code

The following collection objects are available:

Collections of child objects Collections of references to objects

Some of the collections are connectable objects. This means that they provide connection points of two types — one that uses a dispatch interface, and one that uses interface derived from IUnknown — and therefore support communication between ABBYY FlexiCapture SDK and its clients. See Working with Connectable Objects for details.

Working with collections in .NET

All collection interfaces are derived from IEnumerable interface. This means that you can use the foreach statement in C# (for each in Visual Basic) to manipulate collections. Note that working with collections using foreach has some specifics, e.g. enumerators cannot be used to modify the collection, but only to read the data in it. See remarks on

C# code

See also


15.08.2023 13:19:30

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.