> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 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**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/count.md) and [**Element**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/element.md) properties and the [**Item**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/item.md) 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.

> [!WARNING]
>
> The indexing of ABBYY FlexiCapture SDK collections starts with 0.

Below is an example of using the [**StringsCollection**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/stringscollection.md) and [**IntsCollection**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/intscollection.md) objects in C++:

> [accordion] C# code
>
> ```csharp theme={null}
> // Global ABBYY FlexiCapture SDK Engine object
> FCEngine.IEngine Engine = null;
> ...
> // Create the collection and add strings
> FCEngine.IStringsCollection fileList = Engine.CreateStringsCollection();
> fileList.Add( @"D:\SampleImages\0001.tif" );
> fileList.Add( @"D:\SampleImages\0002.tif" );
> fileList.Add( @"D:\SampleImages\0003.tif" );
> ...
> // Use the collection as the input parameter of some method.
> // Suppose we already have the Batch object.
> batch.AddImages( fileList );
> ```

The following collection objects are available:

<table width="100%"><thead><tr><th>**Collections of child objects**</th><th>**Collections of references to objects**</th></tr></thead><tbody><tr><td><ul><li>[**AssemblingErrors**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/assemblingerrors.md) — collection of [**AssemblingError**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/assemblingerror.md) objects</li><li>[**Batches**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/batches.md) — collection of [**Batch**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/batch.md) objects</li><li>[**BatchTypes**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/batchtypes.md) — collection of [**BatchType**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/batchtype.md) objects</li><li>[**BlockDefinitions**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/blockdefinitions.md) — collection of [**BlockDefinition**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/blockdefinition.md) objects</li><li>[**Blocks**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/blocks.md) — collection of [**Block**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/block.md) objects</li><li>[**BusinessUnitRecords**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/businessunitrecords.md) — collection of [**BusinessUnitRecord**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/businessunitrecord.md) objects</li><li>[**CheckmarkGroupBlock**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/checkmarkgroupblock.md) — collection of [**CheckmarkBlock**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/checkmarkblock.md) objects</li><li>[**ClassificationTrainingBatches**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/classificationtrainingbatches.md) — collection of [**ClassificationTrainingBatch**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/classificationtrainingbatch.md) objects</li><li>[**ClassificationTrainingDocuments**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/classificationtrainingdocuments.md) — collection of [**ClassificationTrainingDocument**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/classificationtrainingdocument.md) objects</li><li>[**ClassificationTrainingPages**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/classificationtrainingpages.md) — collection of [**ClassificationTrainingPage**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/classificationtrainingpage.md) objects</li><li>[**Countries**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/countries.md) — collection of [**Country**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/country.md) objects</li><li>[**DataSets**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/datasets.md) — collection of [**DataSet**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/dataset.md) objects</li><li>[**DataSetTableColumns**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/datasettablecolumns.md) — collection of [**DataSetTableColumn**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/datasettablecolumn.md) objects</li><li>[**DataSetTableRecords**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/datasettablerecords.md) — collection of [**DataSetTableRecord**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/datasettablerecord.md) objects</li><li>[**DocumentDefinitions**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/documentdefinitions.md) — collection of [**DocumentDefinition**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/documentdefinition.md) objects</li><li>[**Documents**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/documents.md) — collection of [**Document**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/document.md) objects</li><li>[**EnvironmentVariables**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/environmentvariables.md) — collection of [**EnvironmentVariable**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/environmentvariable.md) objects</li></ul><ul><li>[**ExtractionModels**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/extractionmodels.md) — collection of [**ExtractionModel**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/extractionmodel.md) objects</li></ul><ul><li>[**FieldDefinitions**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/fielddefinitions.md) — collection of [**FieldDefinition**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/fielddefinition.md) objects</li><li>[**FieldInstances**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/fieldinstances.md) — collection of [**Field**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/field.md) objects</li><li>[**FieldRegions**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/fieldregions.md) — collection of [**FieldRegion**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/fieldregion.md) objects</li><li>[**Fields**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/fields.md) — collection of [**Field**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/field.md) objects</li><li>[**FieldsExtractionTrainingBatches**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/fieldsextractiontrainingbatches.md) — collection of [**FieldsExtractionTrainingBatch**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/fieldsextractiontrainingbatch.md) objects</li><li>[**GroupLanguage**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/grouplanguage.md) — collection of [**Language**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/language.md) objects</li><li>[**HotFolderProfiles**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/hotfolderprofiles.md) — collection of [**HotFolderProfile**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/hotfolderprofile.md) objects</li><li>[**InvoiceFeatures**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/invoicefeatures.md) — collection of [**InvoiceFeature**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/invoicefeature.md) objects</li><li>[**InvoiceLanguages**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/invoicelanguages.md) — collection of [**InvoiceLanguage**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/invoicelanguage.md) objects</li><li>[**KeywordLists**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/keywordlists.md) — collection of [**KeywordList**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/keywordlist.md) objects</li><li>[**LinksToSections**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/linkstosections.md) — collection of [**LinkToSection**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/linktosection.md) objects</li><li>[**PageClasses**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/pageclasses.md) — collection of [**PageClass**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/pageclass.md) objects</li><li>[**PageDefinitions**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/pagedefinitions.md) — collection of [**PageDefinition**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/pagedefinition.md) objects</li><li>[**Pages**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/pages.md) — collection of [**Page**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/page.md) objects</li><li>[**PredefinedLanguages**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/predefinedlanguages.md) — collection of [**Language**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/language.md) objects</li><li>[**RegionsCollection**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/regionscollection.md) — collection of [**Region**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/region.md) objects</li><li>[**RuleErrors**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/ruleerrors.md) — collection of [**RuleError**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/ruleerror.md) objects</li><li>[**SectionDefinitions**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/sectiondefinitions.md) — collection of [**SectionDefinition**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/sectiondefinition.md) objects</li><li>[**StatusReasons**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/statusreasons.md) — collection of [**StatusReason**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/statusreason.md) objects</li><li>[**StatusValues**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/statusvalues.md) — collection of [**StatusValue**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/statusvalue.md) objects</li><li>[**TableColumns**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/tablecolumns.md) — collection of [**TableColumn**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/tablecolumn.md) objects</li><li>[**Taxes**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/taxes.md) — collection of [**Tax**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/tax.md) objects</li><li>[**TaxGroups**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/taxgroups.md) — collection of [**TaxGroup**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/taxgroup.md) objects</li><li>[**TextRegions**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/textregions.md) — collection of [**TextRegion**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/textregion.md) objects</li><li>[**VendorRecords**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/vendorrecords.md) — collection of [**VendorRecord**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/vendorrecord.md) objects</li><li>[**VerificationGroup**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/verificationgroup.md) — collection of [**VerificationObject**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/verificationobject.md) objects</li><li>[**VirtualFileSystemNodes**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/virtualfilesystemnodes.md) — collection of [**VirtualFileSystemNode**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/virtualfilesystemnode.md) objects</li></ul></td><td><ul><li>[**BlocksCollection**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/blockscollection.md) — collection of blocks</li><li>[**BlockTypesCollection**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/blocktypescollection.md) — collection of block types\
&#x20;Important! Does not implement **IEnumerable**</li><li>[**FieldDefinitionsCollection**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/fielddefinitionscollection.md) — collection of field definitions</li><li>[**FieldValuesCollection**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/fieldvaluescollection.md) — collection of field values</li><li>[**IntsCollection**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/intscollection.md) — collection of [**Integer**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/propertiestypes.md) type variables</li><li>[**LicenseCollection**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/licensecollection.md) — collection of licenses</li><li>[**SectionDefinitionsCollection**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/sectiondefinitionscollection.md) — collection of section definitions</li><li>[**StringsCollection**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/stringscollection.md) — collection of strings</li><li>[**TextsCollection**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/textscollection.md) — collection of [**Text**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/text.md) objects</li></ul></td></tr></tbody></table>

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](https://docs.abbyy.com/flexi-capture/sdk/guided-tour/connectableobjects.md) 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 [msdn.microsoft.com](http://msdn.microsoft.com/en-us/library/system.collections.ienumerator.aspx).

> [accordion] C# code
>
> ```csharp theme={null}
> // We presume that the document contains some pages
> ...
> foreach( var page in document.Pages ) {
>  // do something with the page
> }
> ```

## See also

[**ICollectionEvents**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/icollectionevents.md)
