# CollectionSchema Class

> Provides for adding/removing/retrieving schema fields in a collection.

- Product: Adobe PDF Library 21
- Language: .NET Framework
- Version: APDFL21.0.0PlusP1e
- HTML page: https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/CollectionSchema
- Version index: https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/llms.txt

```csharp
class CollectionSchema : SystemIDisposable
```

**Namespace:** `Datalogics::PDFL`

**Inherits from:** `SystemIDisposable`

## Description

Provides for adding/removing/retrieving schema fields in a collection.

**Referenced by:** [`Collection`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Collection.md)

**Uses types:** [`CollectionSchemaField`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/CollectionSchemaField.md)

## Properties

### FieldsNumber

```csharp
int Datalogics.PDFL.CollectionSchema.FieldsNumber { get; }
```

GetFieldsNumber allows to obtain fields number in the schema.

## Methods

### AddField

```csharp
void Datalogics.PDFL.CollectionSchema.AddField(CollectionSchemaField field)
```

**Parameters**

- `field` ([`CollectionSchemaField`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/CollectionSchemaField.md)): CollectionSchemaField object which will be added to the schema.

**Returns:** `void`

AddField allows to set new field to the CollectionSchema object. If the target field exists, it is overwritten.

The schema fields contain all information required to organize Collection in a certain way.

### Dispose

```csharp
void Datalogics.PDFL.CollectionSchema.Dispose()
```

**Returns:** `void`

### GetField

```csharp
CollectionSchemaField Datalogics.PDFL.CollectionSchema.GetField(int idx)
```

**Parameters**

- `idx` (`int`): index of the object to find.

**Returns:** [`CollectionSchemaField`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/CollectionSchemaField.md)

CollectionSchemaField object if found or NULL otherwise.

GetField allows to obtain CollectionSchemaField object by its index.

### GetField

```csharp
CollectionSchemaField Datalogics.PDFL.CollectionSchema.GetField(string name)
```

**Parameters**

- `name` (`string`): textual field name.

**Returns:** [`CollectionSchemaField`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/CollectionSchemaField.md)

CollectionSchemaField object if found or NULL otherwise.

GetField allows to obtain CollectionSchemaField by name.

### RemoveField

```csharp
void Datalogics.PDFL.CollectionSchema.RemoveField(CollectionSchemaField field)
```

**Parameters**

- `field` ([`CollectionSchemaField`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/CollectionSchemaField.md)): CollectionSchemaField which will be removed from the schema.

**Returns:** `void`

RemoveField allows to remove specified field from the schema.

NOTE: to distinguish whether specified object belongs to the schema this uses CollectionSchemaField's name.
