# OpcStatusCollection Members

> Reference: Representes a collection of OpcStatus instances.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcStatusCollection</a></dd>
<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>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

Inherits members from [OpcCollection&lt;OpcStatus, StatusCode, StatusCodeCollection&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccollection-3/members), [Collection&lt;OpcStatus&gt;](https://learn.microsoft.com/dotnet/api/system.collections.objectmodel.collection-1).

## Constructors

### OpcStatusCollection

<span class="api-meta">6 overloads</span>

| Overload | Description |
|---|---|
| [OpcStatusCollection()](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/members#opcstatuscollection-noparams) | Initializes a new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) class. |
| [OpcStatusCollection(IList&lt;OpcStatus&gt;)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/members#opcstatuscollection-system-collections-generic-ilist-of-opc-uafx-opcstatus) | Initializes a new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) class as a wrapper for the specified `list`. |
| [OpcStatusCollection(IEnumerable&lt;OpcStatus&gt;)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/members#opcstatuscollection-system-collections-generic-ienumerable-of-opc-uafx-opcstatus) | Initializes a new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) class with the `items` specified. |
| [OpcStatusCollection(params OpcStatus\[\])](#opcstatuscollection-opc-uafx-opcstatus-array) | Initializes a new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) class with the `items` specified. |
| [OpcStatusCollection(IEnumerable&lt;OpcStatusCode&gt;)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/members#opcstatuscollection-system-collections-generic-ienumerable-of-opc-uafx-opcstatuscode) | Initializes a new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) class with the `statusCodes` specified. |
| [OpcStatusCollection(params OpcStatusCode\[\])](#opcstatuscollection-opc-uafx-opcstatuscode-array) | Initializes a new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) class with the `statusCodes` specified. |

#### OpcStatusCollection()

Initializes a new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) class.

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

```csharp
public OpcStatusCollection()
```

</div>

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

```vbnet
Public Sub New()
```

</div>

#### OpcStatusCollection(IList&lt;OpcStatus&gt;)

Initializes a new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) class as a wrapper for the specified `list`.

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

```csharp
public OpcStatusCollection(IList<OpcStatus> list)
```

</div>

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

```vbnet
Public Sub New(list As IList(Of OpcStatus))
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `list` | [IList](https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1)&lt;[OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/)&gt; | The [IList&lt;T&gt;](https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1) of [OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/) instances to wrap. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `list` is a null reference (Nothing in Visual Basic). |

#### OpcStatusCollection(IEnumerable&lt;OpcStatus&gt;)

Initializes a new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) class with the `items` specified.

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

```csharp
public OpcStatusCollection(IEnumerable<OpcStatus> items)
```

</div>

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

```vbnet
Public Sub New(items As IEnumerable(Of OpcStatus))
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `items` | [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/)&gt; | The [IEnumerable&lt;T&gt;](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1) of [OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/) instances to use as the initial items of the collection. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `items` is a null reference (Nothing in Visual Basic). |

#### OpcStatusCollection(params OpcStatus\[\])

Initializes a new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) class with the `items` specified.

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

```csharp
public OpcStatusCollection(params OpcStatus[] items)
```

</div>

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

```vbnet
Public Sub New(ParamArray items As OpcStatus())
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `items` | params [OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/)[] | An array of [OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/) items to use as the initial items of the collection. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `items` is a null reference (Nothing in Visual Basic). |

#### OpcStatusCollection(IEnumerable&lt;OpcStatusCode&gt;)

Initializes a new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) class with the `statusCodes` specified.

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

```csharp
public OpcStatusCollection(IEnumerable<OpcStatusCode> statusCodes)
```

</div>

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

```vbnet
Public Sub New(statusCodes As IEnumerable(Of OpcStatusCode))
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `statusCodes` | [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/)&gt; | The [IEnumerable&lt;T&gt;](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1) of [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) values from which the according [OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/) instances where created and added as the initial items of the collection. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `statusCodes` is a null reference (Nothing in Visual Basic). |

#### OpcStatusCollection(params OpcStatusCode\[\])

Initializes a new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) class with the `statusCodes` specified.

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

```csharp
public OpcStatusCollection(params OpcStatusCode[] statusCodes)
```

</div>

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

```vbnet
Public Sub New(ParamArray statusCodes As OpcStatusCode())
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `statusCodes` | params [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/)[] | An array of [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) values to use to create the according [OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/) instances which are added as the initial items of the collection. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `statusCodes` is a null reference (Nothing in Visual Basic). |

## Methods

### Add

Adds a new item to the end of the collection using the `statusCode` specified.

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

```csharp
public OpcStatus Add(OpcStatusCode statusCode)
```

</div>

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

```vbnet
Public Function Add(statusCode As OpcStatusCode) As OpcStatus
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `statusCode` | [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) | The [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) value to use to create a new [OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/) instance which is then added to the end of the collection. |

**Returns**

[OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/)

A new instance of the [OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/) class initialized with the `statusCode` specified and added to the end of the collection.

### Create

<span class="api-meta">static</span>

Creates a new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) with a initial number of items defined by `count`, where each item represents an instance of the [OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/) class initialized using the `statusCode` passed.

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

```csharp
public static OpcStatusCollection Create(OpcStatusCode statusCode, int count)
```

</div>

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

```vbnet
<CLSCompliant(False)>
Public Shared Function Create(
    statusCode As OpcStatusCode,
    count As Integer) As OpcStatusCollection
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `statusCode` | [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) | The [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) value to use for the items to add as the initial entries of the collection to create. |
| `count` | [Int32](https://learn.microsoft.com/dotnet/api/system.int32) | The number of items to create from the `statusCode` specified to add as the initial entries of the collection to create. |

**Returns**

[OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/)

A new instance of the [OpcStatusCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscollection/) class initialized with the number of items specified by `count`, where each instance of the [OpcStatus](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatus/) in this collection has been created from the `statusCode` passed.
