# OpcContentFilter Members

> Reference: Represents a content filter, which consists of elements applying an operator to their operands.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcContentFilter</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>

## Constructors

### OpcContentFilter

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

| Overload | Description |
|---|---|
| [OpcContentFilter(params OpcContentFilterElement\[\])](#opccontentfilter-opc-uafx-opccontentfilterelement-array) | Initializes a new instance of the [OpcContentFilter](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontentfilter/) class using the `elements` specified. |
| [OpcContentFilter(IEnumerable&lt;OpcContentFilterElement&gt;)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontentfilter/members#opccontentfilter-system-collections-generic-ienumerable-of-opc-uafx-opccontentfilterelement) | Initializes a new instance of the [OpcContentFilter](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontentfilter/) class using the `elements` specified. |

**Exceptions (all overloads)**

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

#### OpcContentFilter(params OpcContentFilterElement\[\])

Initializes a new instance of the [OpcContentFilter](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontentfilter/) class using the `elements` specified.

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

```csharp
public OpcContentFilter(params OpcContentFilterElement[] elements)
```

</div>

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

```vbnet
Public Sub New(ParamArray elements As OpcContentFilterElement())
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `elements` | params [OpcContentFilterElement](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontentfilterelement/)[] | The elements of the filter. |

#### OpcContentFilter(IEnumerable&lt;OpcContentFilterElement&gt;)

Initializes a new instance of the [OpcContentFilter](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontentfilter/) class using the `elements` specified.

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

```csharp
public OpcContentFilter(IEnumerable<OpcContentFilterElement> elements)
```

</div>

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

```vbnet
Public Sub New(elements As IEnumerable(Of OpcContentFilterElement))
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `elements` | [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[OpcContentFilterElement](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontentfilterelement/)&gt; | A sequence of the elements of the filter. |

## Properties

### Elements

Gets the elements of the filter.

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

```csharp
public OpcContentFilterElementReadOnlyCollection Elements { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Elements As OpcContentFilterElementReadOnlyCollection
```

</div>

**Property value**

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

A read-only collection of the elements.

**Remarks**

For a filter created using the operators &amp; and | of [OpcContentFilterElement](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontentfilterelement/), the collection contains the elements combining other elements, the most recent one first, but not the elements combined by them.

## Methods

### ToString

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

Returns a string that represents the filter.

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

```csharp
public override string ToString()
```

</div>

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

```vbnet
Public Overrides Function ToString() As String
```

</div>

**Returns**

[String](https://learn.microsoft.com/dotnet/api/system.string)

The string representation of the filter provided by the OPC UA stack.

**Overrides**

[ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)
