# DataRelationInfoCollection Class

> An instance of the DataRelationInfoCollection class contains all data relations in a data source represented through objects of the type DataRelationInfo. The DataRelationInfoCollection class implements the interface ICollection<DataRelationInfo> and therefore also IEnumerable<DataRelationInfo>. This collection class is meant to be read only. For this reason all ICollection members which would cause changes to the collection content (e. g. Add(), Clear() or Remove()) throw a NotSupportedException.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 24.0
- **Namespace:** `TXTextControl.DocumentServer.DataSources`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXDocumentServer.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXDocumentServer.dll` from the setup
- **Implements:** `System.Collections.Generic.ICollection<TXTextControl.DocumentServer.DataSources.DataRelationInfo>`, `System.Collections.Generic.IEnumerable<TXTextControl.DocumentServer.DataSources.DataRelationInfo>`, `System.Collections.IEnumerable`
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl.DocumentServer.DataSources > DataRelationInfoCollection Class
- **996 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/llms-full.txt

---

### Description

An instance of the DataRelationInfoCollection class contains all data relations in a data source represented through objects of the type [DataRelationInfo](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfo/llms-full.txt). The DataRelationInfoCollection class implements the interface ICollection<DataRelationInfo> and therefore also IEnumerable<DataRelationInfo>. This collection class is meant to be read only. For this reason all ICollection members which would cause changes to the collection content (e. g. Add(), Clear() or Remove()) throw a `NotSupportedException`.

### Syntax

```csharp
public sealed class DataRelationInfoCollection : ICollection<DataRelationInfo>, IEnumerable<DataRelationInfo>, IEnumerable
```

```vbnet
Public NotInheritable Class DataRelationInfoCollection
    Implements ICollection(Of DataRelationInfo), IEnumerable(Of DataRelationInfo), IEnumerable
```

### Examples

The following example includes the item value from a Data Relation Info Collection object in application diagnostics. The created object is then available to the surrounding document workflow.

```csharp
Console.WriteLine($"Item: {dataRelationInfoCollection[1]}");
Console.WriteLine("Data Relation Info Collection is ready for use.");
```

```vbnet
Console.WriteLine($"Item: {dataRelationInfoCollection.Item(1)}")
Console.WriteLine("Data Relation Info Collection is ready for use.")
```

---

## In This Section

- [DataRelationInfoCollection.CopyTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/copyto-method/llms-full.txt): Copies the elements of the collection to an array, starting at a particular index.
- [DataRelationInfoCollection.Count Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/count-property/llms-full.txt): Gets the number of elements contained in the collection.
- [DataRelationInfoCollection.GetEnumerator Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/getenumerator-method/llms-full.txt): Returns an enumerator that can be used to iterate through the collection.
- [DataRelationInfoCollection.IsReadOnly Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/isreadonly-property/llms-full.txt): Gets a value indicating whether the collection is read only. Always returns true.
- [DataRelationInfoCollection.Item Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/item-property/llms-full.txt): Gets the DataRelationInfo instance with the specified 0-based index from the collection. In C# this property is the indexer for the DataRelationInfoCollection class.

---

## Nearby

- **Previous:** [DataRelationInfo.RelationName Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfo/relationname-property/llms-full.txt)
- **Next:** [DataRelationInfoCollection.CopyTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-documentserver-datasources/datarelationinfocollection/copyto-method/llms-full.txt)
