# OpcCollection&lt;TItem, TItemContent, TItemContentList&gt; Class

> Reference: Provides an abstract generic base class for IOpcContainer items their content is maintained in a different list which is to be used as the content of the collection like TItem uses the TItemContent instances in TItemContentList.

<span class="api-meta">abstract · since v2.7</span>

<dl class="api-definition">
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx">Opc.UaFx</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
<dt>Members</dt>
<dd><a href="./members">OpcCollection&lt;TItem, TItemContent, TItemContentList&gt; Members</a></dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

Provides an abstract generic base class for `IOpcContainer` items their content is maintained in a different list which is to be used as the content of the collection like `TItem` uses the `TItemContent` instances in `TItemContentList`.

## Syntax

<div class="api-signature" data-lang="csharp">

```csharp
public abstract class OpcCollection<TItem, TItemContent, TItemContentList> : Collection<TItem>
    where TItem : IOpcContainer<TItemContent>
    where TItemContentList : class, IList<TItemContent>, new()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public MustInherit Class OpcCollection(Of TItem As IOpcContainer(Of TItemContent), TItemContent, TItemContentList As {Class, IList(Of TItemContent), New})
    Inherits Collection(Of TItem)
```

</div>

## Type parameters

| Name | Description |
|---|---|
| `TItem` | The type of items in the collection which implements the `IOpcContainer` to interface to maintain an instance of the type defined by `TItemContent`. |
| `TItemContent` | The type of content maintained by the type defined by `TItem`. |
| `TItemContentList` | The type of `TItemContentList` to maintained and represented by the collection. |

## Inheritance

[Object](https://learn.microsoft.com/dotnet/api/system.object) → [Collection](https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.collection-1)&lt;TItem&gt; → **OpcCollection&lt;TItem, TItemContent, TItemContentList&gt;**

## Implements

<ul class="api-implements">
<li><a href="https://learn.microsoft.com/dotnet/api/system.collections.icollection">ICollection</a></li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.collections.generic.icollection-1">ICollection</a>&lt;TItem&gt;</li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.collections.ienumerable">IEnumerable</a></li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a>&lt;TItem&gt;</li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.collections.ilist">IList</a></li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;TItem&gt;</li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlycollection-1">IReadOnlyCollection</a>&lt;TItem&gt;</li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1">IReadOnlyList</a>&lt;TItem&gt;</li>
</ul>

## Derived types

- [OpcArgumentCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcargumentcollection/)
- [OpcNameCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnamecollection/)
- [OpcReferenceCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencecollection/)
- [OpcReferenceDescriptionCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreferencedescriptioncollection/)
- [OpcResultCollection&lt;TItem, TItemContent, TItemContentList&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresultcollection-3/)
- [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/)
- [OpcLocalReferenceCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opclocalreferencecollection/)

## Constructors

| Name | Description |
|---|---|
| [OpcCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccollection-3/members#opccollection)<span class="api-meta">protected · 2 overloads</span> | Initializes a new instance of the OpcCollection&lt;TItem, TItemContent, TItemContentList&gt; class. |

## Methods

| Name | Description |
|---|---|
| [ClearItems](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccollection-3/members#clearitems)<span class="api-meta">protected · override</span> | Removes all elements from the OpcCollection&lt;TItem, TItemContent, TItemContentList&gt;. |
| [InsertItem](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccollection-3/members#insertitem)<span class="api-meta">protected · override</span> | Inserts an element into the OpcCollection&lt;TItem, TItemContent, TItemContentList&gt; at the specified index. |
| [RemoveItem](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccollection-3/members#removeitem)<span class="api-meta">protected · override</span> | Removes the element at the specified index of the OpcCollection&lt;TItem, TItemContent, TItemContentList&gt;. |
| [SetItem](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccollection-3/members#setitem)<span class="api-meta">protected · override</span> | Replaces the element at the specified index. |

Inherits members from [Collection&lt;TItem&gt;](https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.collection-1).

## Applies to

| Package | Versions |
|---|---|
| Opc.UaFx.Advanced | v2.7–v2.59 |
