> ## 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.

# コレクションの操作

ABBYY FlexiCapture SDK のコレクションには 2 種類あります。

1 つ目は、既存のオブジェクトへの参照を格納するコレクションです。通常、このようなコレクションは、さまざまなパラメーターのセットを、それを必要とするメソッドに渡すために使用します。コレクションを作成して要素を追加し (要素は既存のオブジェクトへの参照として追加されます) 、必要なメソッドに渡した後、コレクションを破棄します。このとき、コレクションに追加したオブジェクトは破棄されずに残ります。このようなコレクションの名前には、*Collection* という接尾辞が付いています (例: **StringsCollection**、**IntsCollection**、**SectionDefinitionsCollection**) 。

もう 1 つは、ある親オブジェクトの子オブジェクトを格納するコレクションです。このコレクションは、親オブジェクトが存在する間だけ存在します。このようなコレクションを介して、親オブジェクトの子オブジェクトを追加または削除できます。コレクションに要素を追加すると、内部で新しいオブジェクトが作成され、コレクションに追加されます。このようなコレクションには、たとえば **SectionDefinitions** (セクション定義のコレクション) や **Pages** (Documentページのコレクション) があります。

ABBYY FlexiCapture SDK の各コレクションには、[**Count**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/count.md) プロパティと [**Element**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/element.md) プロパティ、および [**Item**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/item.md) メソッドがあります。1 つ目はコレクションに実際に含まれている要素の数を取得し、2 つ目と 3 つ目は指定したインデックスにある要素を取得します。**Element** プロパティを使用すると、C# の \[] 演算子でコレクションの要素にアクセスできます。その他のプロパティとメソッドは、コレクションごとに異なります。

> [!WARNING]
>
> ABBYY FlexiCapture SDK のコレクションのインデックスは 0 から始まります。

以下は、C++ で [**StringsCollection**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/stringscollection.md) オブジェクトと [**IntsCollection**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/intscollection.md) オブジェクトを使用する例です。

> [accordion] C# コード
>
> ```csharp theme={null}
> // グローバルな ABBYY FlexiCapture SDK Engine オブジェクト
> FCEngine.IEngine Engine = null;
> ...
> // コレクションを作成し、文字列を追加する
> FCEngine.IStringsCollection fileList = Engine.CreateStringsCollection();
> fileList.Add( @"D:\SampleImages\0001.tif" );
> fileList.Add( @"D:\SampleImages\0002.tif" );
> fileList.Add( @"D:\SampleImages\0003.tif" );
> ...
> // コレクションを何らかのメソッドの入力パラメーターとして使用する。
> // Batch オブジェクトがすでにあると仮定する。
> batch.AddImages( fileList );
> ```

使用できるコレクションオブジェクトは次のとおりです。

<table width="100%">
  <thead>
    <tr>
      <th>
        **子オブジェクトのコレクション**
      </th>

      <th>
        **オブジェクト参照のコレクション**
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        <ul>
          <li>
            [**AssemblingErrors**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/assemblingerrors.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**AssemblingError**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/assemblingerror.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**Batches**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/batches.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**Batch**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/batch.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**BatchTypes**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/batchtypes.md)

            &#x20;

            — 次の型のコレクション：&#x20;

            [**BatchType**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/batchtype.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**BlockDefinitions**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/blockdefinitions.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**BlockDefinition**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/blockdefinition.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**Blocks**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/blocks.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**Block**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/block.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**BusinessUnitRecords**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/businessunitrecords.md)

            &#x20;

            — 次のオブジェクトのコレクション:&#x20;

            [**BusinessUnitRecord**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/businessunitrecord.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**CheckmarkGroupBlock**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/checkmarkgroupblock.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**CheckmarkBlock**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/checkmarkblock.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**ClassificationTrainingBatches**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/classificationtrainingbatches.md)

            &#x20;

            — 次のオブジェクトのコレクション:&#x20;

            [**ClassificationTrainingBatch**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/classificationtrainingbatch.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**ClassificationTrainingDocuments**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/classificationtrainingdocuments.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**ClassificationTrainingDocument**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/classificationtrainingdocument.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**ClassificationTrainingPages**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/classificationtrainingpages.md)

            &#x20;

            — &#x20;

            [**ClassificationTrainingPage**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/classificationtrainingpage.md)

            のコレクション

            &#x20;

            オブジェクト
          </li>

          <li>
            [**国**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/countries.md)

            &#x20;

            — コレクション：&#x20;

            [**Country**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/country.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**DataSets**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/datasets.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**DataSet**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/dataset.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**DataSetTableColumns**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/datasettablecolumns.md)

            &#x20;

            — 次のオブジェクトのコレクション:&#x20;

            [**DataSetTableColumn**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/datasettablecolumn.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**DataSetTableRecords**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/datasettablerecords.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**DataSetTableRecord**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/datasettablerecord.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**DocumentDefinitions**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/documentdefinitions.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**DocumentDefinition**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/documentdefinition.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**Documents**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/documents.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**Document**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/document.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**EnvironmentVariables**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/environmentvariables.md)

            &#x20;

            — 次のオブジェクトのコレクション:&#x20;

            [**EnvironmentVariable**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/environmentvariable.md)

            &#x20;

            オブジェクト
          </li>
        </ul>

        <ul>
          <li>
            [**ExtractionModels**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/extractionmodels.md)

            &#x20;

            — &#x20;

            [**ExtractionModel**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/extractionmodel.md)

            &#x20;

            オブジェクトのコレクション
          </li>
        </ul>

        <ul>
          <li>
            [**FieldDefinitions**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/fielddefinitions.md)

            &#x20;

            —&#x20;

            [**FieldDefinition**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/fielddefinition.md)

            のコレクション

            &#x20;

            オブジェクト
          </li>

          <li>
            [**FieldInstances**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/fieldinstances.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**Field**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/field.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**FieldRegions**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/fieldregions.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**FieldRegion**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/fieldregion.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**Fields**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/fields.md)

            &#x20;

            — コレクション:&#x20;

            [**Field**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/field.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**FieldsExtractionTrainingBatches**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/fieldsextractiontrainingbatches.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**FieldsExtractionTrainingBatch**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/fieldsextractiontrainingbatch.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**GroupLanguage**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/grouplanguage.md)

            &#x20;

            — &#x20;

            [**Language**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/language.md)

            のコレクション

            &#x20;

            オブジェクト
          </li>

          <li>
            [**HotFolderProfiles**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/hotfolderprofiles.md)

            &#x20;

            — 次のオブジェクトのコレクション:&#x20;

            [**HotFolderProfile**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/hotfolderprofile.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**InvoiceFeatures**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/invoicefeatures.md)

            &#x20;

            — 次のコレクション:&#x20;

            [**InvoiceFeature**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/invoicefeature.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**InvoiceLanguages**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/invoicelanguages.md)

            &#x20;

            —&#x20;

            [**InvoiceLanguage**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/invoicelanguage.md)

            のコレクション

            &#x20;

            オブジェクト
          </li>

          <li>
            [**KeywordLists**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/keywordlists.md)

            &#x20;

            — 次のコレクション:&#x20;

            [**KeywordList**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/keywordlist.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**LinksToSections**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/linkstosections.md)

            &#x20;

            — 次のオブジェクトのコレクション:&#x20;

            [**LinkToSection**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/linktosection.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**PageClasses**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/pageclasses.md)

            &#x20;

            — &#x20;

            [**PageClass**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/pageclass.md)

            のコレクション

            &#x20;

            オブジェクト
          </li>

          <li>
            [**PageDefinitions**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/pagedefinitions.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**PageDefinition**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/pagedefinition.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**Pages**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/pages.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**Page**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/page.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**PredefinedLanguages**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/predefinedlanguages.md)

            &#x20;

            —

            [**Language**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/language.md)

            &#x20;のコレクション

            &#x20;

            オブジェクト
          </li>

          <li>
            [**RegionsCollection**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/regionscollection.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**Region**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/region.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**RuleErrors**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/ruleerrors.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**RuleError**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/ruleerror.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**SectionDefinitions**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/sectiondefinitions.md)

            &#x20;

            —&#x20;

            [**SectionDefinition**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/sectiondefinition.md)

            のコレクション

            &#x20;

            オブジェクト
          </li>

          <li>
            [**StatusReasons**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/statusreasons.md)

            &#x20;

            — 次の型のコレクション:&#x20;

            [**StatusReason**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/statusreason.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**StatusValues**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/statusvalues.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**StatusValue**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/statusvalue.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**TableColumns**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/tablecolumns.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**TableColumn**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/tablecolumn.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**税**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/taxes.md)

            &#x20;

            — 次の要素のコレクション:&#x20;

            [**Tax**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/tax.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**TaxGroups**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/taxgroups.md)

            &#x20;

            — 要素の型が次のコレクション:&#x20;

            [**TaxGroup**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/taxgroup.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**TextRegions**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/textregions.md)

            &#x20;

            — &#x20;

            [**TextRegion**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/textregion.md)

            のコレクション

            &#x20;

            オブジェクト
          </li>

          <li>
            [**VendorRecords**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/vendorrecords.md)

            &#x20;

            — 次のコレクション:&#x20;

            [**VendorRecord**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/vendorrecord.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**VerificationGroup**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/verificationgroup.md)

            &#x20;

            — 次のオブジェクトのコレクション：&#x20;

            [**VerificationObject**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/verificationobject.md)

            &#x20;

            オブジェクト
          </li>

          <li>
            [**VirtualFileSystemNodes**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/virtualfilesystemnodes.md)

            &#x20;

            — 次のコレクション:&#x20;

            [**VirtualFileSystemNode**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/virtualfilesystemnode.md)

            &#x20;

            オブジェクト
          </li>
        </ul>
      </td>

      <td>
        <ul>
          <li>
            [**BlocksCollection**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/blockscollection.md)

            &#x20;

            — ブロックのコレクション
          </li>

          <li>
            [**BlockTypesCollection**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/blocktypescollection.md)

            &#x20;

            — ブロック型のコレクション
            \
            &#x20;重要: **IEnumerable** は実装していません
          </li>

          <li>
            [**FieldDefinitionsCollection**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/fielddefinitionscollection.md)

            &#x20;

            — field 定義のコレクション
          </li>

          <li>
            [**FieldValuesCollection**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/fieldvaluescollection.md)

            &#x20;

            — フィールド値のコレクション
          </li>

          <li>
            [**IntsCollection**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/intscollection.md)

            &#x20;

            —&#x20;

            [**Integer**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/propertiestypes.md)

            &#x20;

            型の変数のコレクション
          </li>

          <li>
            [**LicenseCollection**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/licensecollection.md)

            &#x20;

            — ライセンスのコレクション
          </li>

          <li>
            [**SectionDefinitionsCollection**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/sectiondefinitionscollection.md)

            &#x20;

            — セクション定義のコレクション
          </li>

          <li>
            [**StringsCollection**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/stringscollection.md)

            &#x20;

            — 文字列のコレクション
          </li>

          <li>
            [**TextsCollection**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/textscollection.md)

            &#x20;

            —&#x20;

            [**Text**](https://docs.abbyy.com/ja/flexi-capture/sdk/api-reference/text.md)

            &#x20;

            オブジェクトのコレクション
          </li>
        </ul>
      </td>
    </tr>
  </tbody>
</table>

一部のコレクションは接続可能なオブジェクトです。つまり、これらのコレクションは 2 種類の接続ポイント (**dispatch** インターフェイスを使用するものと、*IUnknown* から派生したインターフェイスを使用するもの) を提供しているため、ABBYY FlexiCapture SDK とそのクライアント間の通信をサポートします。詳細については、「[接続可能なオブジェクトの使用](https://docs.abbyy.com/ja/flexi-capture/sdk/guided-tour/connectableobjects.md)」を参照してください。

## .NET でのコレクションの操作

すべてのコレクション インターフェースは **IEnumerable** インターフェイスから派生しています。そのため、C# の **foreach** 文 (Visual Basic では **for each**) を使用してコレクションを操作できます。ただし、**foreach** を使用したコレクションの操作にはいくつかの注意点があります。たとえば、列挙子はコレクション内のデータの読み取りにのみ使用でき、コレクションの変更には使用できません。詳細については、[msdn.microsoft.com](http://msdn.microsoft.com/en-us/library/system.collections.ienumerator.aspx) の解説を参照してください。

> [accordion] C# コード
>
> ```csharp theme={null}
> // ドキュメントにいくつかのページが含まれていると仮定します
> ...
> foreach( var page in document.Pages ) {
>  // ページに対して何らかの処理を行います
> }
> ```

## 関連項目

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