# OpcEvent Members

> Reference: Represents a snapshot of a 'Opc.UaFx.OpcEventNode'.

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

### OpcEvent

<span class="api-meta">since v2.8</span>

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

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

```csharp
public OpcEvent(IOpcReadOnlyNodeDataStore dataStore)
```

</div>

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

```vbnet
Public Sub New(dataStore As IOpcReadOnlyNodeDataStore)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `dataStore` | [IOpcReadOnlyNodeDataStore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcreadonlynodedatastore/) | The [IOpcReadOnlyNodeDataStore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcreadonlynodedatastore/) of the 'Opc.UaFx.OpcEventNode' to represent. |

**Exceptions**

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

## Properties

### DataStore

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

Gets the [IOpcReadOnlyNodeDataStore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcreadonlynodedatastore/) which contains the data of the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) instance.

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

```csharp
protected IOpcReadOnlyNodeDataStore DataStore { get; }
```

</div>

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

```vbnet
Protected ReadOnly Property DataStore As IOpcReadOnlyNodeDataStore
```

</div>

**Property value**

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

An instance implementing the [IOpcReadOnlyNodeDataStore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcreadonlynodedatastore/) interface containing the event data represented by this [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) instance.

### EventId

Gets a value generated by the server to uniquely identify a particular event notification.

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

```csharp
public ByteString EventId { get; }
```

</div>

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

```vbnet
Public ReadOnly Property EventId As ByteString
```

</div>

**Property value**

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

The identifier of the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/). For more information see 'Opc.UaFx.OpcEventNode.EventId'.

### EventType

Gets the type of event.

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

```csharp
public OpcEventType EventType { get; }
```

</div>

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

```vbnet
Public ReadOnly Property EventType As OpcEventType
```

</div>

**Property value**

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

One of the members defined by the [OpcEventType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtype/) enumeration indicating the type of the event represented by the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/). In case of custom event types the value [Event](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtype/#event).

### EventTypeId

Gets node identifier which describes the specific type of event.

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

```csharp
public OpcNodeId EventTypeId { get; }
```

</div>

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

```vbnet
Public ReadOnly Property EventTypeId As OpcNodeId
```

</div>

**Property value**

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

The node identifier of the event type. For more information see 'Opc.UaFx.OpcEventNode.EventTypeId'.

### Message

Gets a value which defines a human-readable and localizable text description of the event.

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

```csharp
public OpcText Message { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Message As OpcText
```

</div>

**Property value**

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

The message of the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/). For more information see 'Opc.UaFx.OpcEventNode.Message'.

### NodeId

Gets the identifier of the node from which this event data snapshot has been created.

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

```csharp
public OpcNodeId NodeId { get; }
```

</div>

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

```vbnet
Public ReadOnly Property NodeId As OpcNodeId
```

</div>

**Property value**

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

The [OpcNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodeid/) of the node this snapshot originates.

### ReceiveTime

Gets the time the OPC UA server received the event from the underlying device of another server.

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

```csharp
public DateTime ReceiveTime { get; }
```

</div>

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

```vbnet
Public ReadOnly Property ReceiveTime As Date
```

</div>

**Property value**

[DateTime](https://learn.microsoft.com/dotnet/api/system.datetime)

The time the server received the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/). For more information see 'Opc.UaFx.OpcEventNode.ReceiveTime'.

### Severity

Gets an indication of the urgency of the event.

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

```csharp
public OpcEventSeverity Severity { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Severity As OpcEventSeverity
```

</div>

**Property value**

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

The severity of the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/). For more information see 'Opc.UaFx.OpcEventNode.Severity'.

### SourceName

Gets a description of the source of the event.

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

```csharp
public string SourceName { get; }
```

</div>

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

```vbnet
Public ReadOnly Property SourceName As String
```

</div>

**Property value**

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

The description of the source of the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/). For more information see 'Opc.UaFx.OpcEventNode.SourceName'.

### SourceNodeId

Gets the node identifier which identifies the node that the event originated from.

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

```csharp
public OpcNodeId SourceNodeId { get; }
```

</div>

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

```vbnet
Public ReadOnly Property SourceNodeId As OpcNodeId
```

</div>

**Property value**

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

The node identifier of the node the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) originates from. For more information see 'Opc.UaFx.OpcEventNode.SourceNodeId'.

### Time

Gets the time the event occurred.

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

```csharp
public DateTime Time { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Time As Date
```

</div>

**Property value**

[DateTime](https://learn.microsoft.com/dotnet/api/system.datetime)

The time the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) occurred. For more information see 'Opc.UaFx.OpcEventNode.Time'.

## Methods

### Create

<span class="api-meta">static · since v2.54</span>

Creates a new [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) instance following the parameters specified.

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

```csharp
public static OpcEvent Create(
    OpcContext context,
    OpcEventFilter filter,
    IEnumerable<object> data)
```

</div>

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

```vbnet
Public Shared Function Create(
    context As OpcContext,
    filter As OpcEventFilter,
    data As IEnumerable(Of Object)) As OpcEvent
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `context` | [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) | The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) to which the new [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) belongs to. |
| `filter` | [OpcEventFilter](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventfilter/) | The [OpcEventFilter](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventfilter/) whose [SelectClause](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventfilter/members#selectclause) defines the order of the `data`. |
| `data` | [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[Object](https://learn.microsoft.com/dotnet/api/system.object)&gt; | A sequence of [object](https://learn.microsoft.com/dotnet/api/system.object) values in the same order as the select-clause operands of the `filter`. Pass [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for fields that are not available. |

**Returns**

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

A new instance of the event type or of one of its (custom) derivates using the `data` specified.

**Exceptions**

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

### GetValue

<span class="api-meta">protected · since v2.19</span>

Retrieves the value of the event field named by the `memberName`, e.g. to implement a property of a custom event type.

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

```csharp
protected T GetValue<T>(string memberName = "")
```

</div>

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

```vbnet
Protected Function GetValue(Of T)(memberName As String = "") As T
```

</div>

**Type parameters**

| Name | Description |
|---|---|
| `T` | The type of the value. |

**Parameters**

| Name | Type | Description |
|---|---|---|
| `memberName` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The name of the field. By default the name of the calling member. Optional, default `""`. |

**Returns**

T

The value of the field as an instance of `T`.

**Remarks**

A `memberName` without a namespace is resolved in the namespace of the event type which declares the member, unless the [EventTypeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#eventtypeid) belongs to the default namespace.

### RegisterType

<span class="api-meta">static · 2 overloads · since v2.8</span>

| Overload | Description |
|---|---|
| [RegisterType&lt;T&gt;()](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertype-t1)<span class="api-meta">static · since v2.8</span> | Registers the type defined by `T` as the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to create in case there an event instance is to be created for the type definition identified by the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) defined on the `T` specified. |
| [RegisterType&lt;T&gt;(OpcNodeId)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertype-t1-opc-uafx-opcnodeid)<span class="api-meta">static · since v2.8</span> | Registers the type defined by `T` as the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to create in case there an event instance is to be created for the type definition identified by the `eventTypeId` specified. |

**Exceptions (all overloads)**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The type `T` does not define the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) or a public accessible constructor accepting an instance of the [IOpcReadOnlyNodeDataStore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcreadonlynodedatastore/) interface or any event type specific attribute offers invalid information about the event type to associate with the [Type](https://learn.microsoft.com/dotnet/api/system.type). |

#### RegisterType&lt;T&gt;()

<span class="api-meta">static · since v2.8</span>

Registers the type defined by `T` as the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to create in case there an event instance is to be created for the type definition identified by the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) defined on the `T` specified.

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

```csharp
public static void RegisterType<T>() where T : OpcEvent
```

</div>

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

```vbnet
Public Shared Sub RegisterType(Of T As OpcEvent)()
```

</div>

**Type parameters**

| Name | Description |
|---|---|
| `T` | The [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to use in case there an event for the event definition equals to event type identifier defined using the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) is to be created. The type needs to provide a public accessible constructor accepting an instance of the [IOpcReadOnlyNodeDataStore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcreadonlynodedatastore/) interface and needs to be a subclass of the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) class. |

#### RegisterType&lt;T&gt;(OpcNodeId)

<span class="api-meta">static · since v2.8</span>

Registers the type defined by `T` as the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to create in case there an event instance is to be created for the type definition identified by the `eventTypeId` specified.

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

```csharp
public static void RegisterType<T>(OpcNodeId eventTypeId) where T : OpcEvent
```

</div>

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

```vbnet
Public Shared Sub RegisterType(Of T As OpcEvent)(eventTypeId As OpcNodeId)
```

</div>

**Type parameters**

| Name | Description |
|---|---|
| `T` | The [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to use in case there an event for the event definition equals to `eventTypeId` is to be created. The type needs to provide a public accessible constructor accepting an instance of the [IOpcReadOnlyNodeDataStore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcreadonlynodedatastore/) interface and needs to be a subclass of the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) class. |

**Parameters**

| Name | Type | Description |
|---|---|---|
| `eventTypeId` | [OpcNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodeid/) | The identifier of the type definition for which the `T` is to be used to create an event instance. |

**Exceptions**

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

**Remarks**

It is not possible to register the same or a different event type for the `eventTypeId` specified as long there is already an event type registered for the type definition specified by `eventTypeId`.

### RegisterTypes

<span class="api-meta">static · 3 overloads · since v2.8</span>

| Overload | Description |
|---|---|
| [RegisterTypes(Assembly)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertypes-system-reflection-assembly)<span class="api-meta">static · since v2.8</span> | Registers all non-abstract types in the `assembly` specified which defines the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) and inherit from [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/). |
| [RegisterTypes(IEnumerable&lt;Type&gt;)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertypes-system-collections-generic-ienumerable-of-system-type)<span class="api-meta">static · since v2.8</span> | Registers the `eventTypes` specified as the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to create in case there an event instance is to be created for one of the type definitions identified by the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) used on one of the `eventTypes` specified. |
| [RegisterTypes(Type, params Type\[\])](#registertypes-system-type-system-type-array)<span class="api-meta">static · since v2.8</span> | Registers the `eventType` and the further specified `eventTypes` as the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) types to create in case there an event instance is to be created for one of the type definitions identified by the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) used on the `eventType` or on one of the `eventTypes` specified. |

**Exceptions (all overloads)**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | A [Type](https://learn.microsoft.com/dotnet/api/system.type) does not define the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) or a public accessible constructor accepting an instance of the [IOpcReadOnlyNodeDataStore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcreadonlynodedatastore/) interface or any event type specific attribute offers invalid information about the event type to associate with the [Type](https://learn.microsoft.com/dotnet/api/system.type). |

#### RegisterTypes(Assembly)

<span class="api-meta">static · since v2.8</span>

Registers all non-abstract types in the `assembly` specified which defines the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) and inherit from [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/).

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

```csharp
public static void RegisterTypes(Assembly assembly)
```

</div>

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

```vbnet
Public Shared Sub RegisterTypes(assembly As Assembly)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `assembly` | [Assembly](https://learn.microsoft.com/dotnet/api/system.reflection.assembly) | The [Assembly](https://learn.microsoft.com/dotnet/api/system.reflection.assembly) its types are inspected for subclasses of the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) class which in addition using the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/). |

**Exceptions**

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

**Remarks**

The [Type](https://learn.microsoft.com/dotnet/api/system.type) instances to register need to define the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) and a public accessible constructor accepting an instance of the [IOpcReadOnlyNodeDataStore](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.iopcreadonlynodedatastore/) interface. Additionally the [Type](https://learn.microsoft.com/dotnet/api/system.type) needs to be a subclass of the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) class.

#### RegisterTypes(IEnumerable&lt;Type&gt;)

<span class="api-meta">static · since v2.8</span>

Registers the `eventTypes` specified as the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to create in case there an event instance is to be created for one of the type definitions identified by the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) used on one of the `eventTypes` specified.

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

```csharp
public static void RegisterTypes(IEnumerable<Type> eventTypes)
```

</div>

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

```vbnet
Public Shared Sub RegisterTypes(eventTypes As IEnumerable(Of Type))
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `eventTypes` | [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[Type](https://learn.microsoft.com/dotnet/api/system.type)&gt; | A sequence of [Type](https://learn.microsoft.com/dotnet/api/system.type) instances representing subclasses of [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) to use in case there an event for the event definition equals to the event type identifier defined using the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) is to be created. |

**Exceptions**

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

**Remarks**

Any null reference (Nothing in Visual Basic) in `eventTypes` is ignored.

#### RegisterTypes(Type, params Type\[\])

<span class="api-meta">static · since v2.8</span>

Registers the `eventType` and the further specified `eventTypes` as the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) types to create in case there an event instance is to be created for one of the type definitions identified by the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) used on the `eventType` or on one of the `eventTypes` specified.

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

```csharp
public static void RegisterTypes(Type eventType, params Type[] eventTypes)
```

</div>

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

```vbnet
Public Shared Sub RegisterTypes(
    eventType As Type,
    ParamArray eventTypes As Type())
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `eventType` | [Type](https://learn.microsoft.com/dotnet/api/system.type) | The [Type](https://learn.microsoft.com/dotnet/api/system.type) instance representing a subclass of the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) to use in case there an event for the event definition equals to the event type identifier defined using the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) is to be created. |
| `eventTypes` | params [Type](https://learn.microsoft.com/dotnet/api/system.type)[] | An array of additional [Type](https://learn.microsoft.com/dotnet/api/system.type) instances representing subclasses of [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) to use in case there an event for the event definition equals to the event type identifier defined using the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) is to be created. |

**Exceptions**

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

### UnregisterType

<span class="api-meta">static · 2 overloads · since v2.8</span>

| Overload | Description |
|---|---|
| [UnregisterType&lt;T&gt;()](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#unregistertype-t1)<span class="api-meta">static · since v2.8</span> | Unregisters the previously registered (see [RegisterType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertype-t1)) type defined by `T` as the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to not longer create for the type definition identified by the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) defined on the `T` specified. |
| [UnregisterType&lt;T&gt;(OpcNodeId)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#unregistertype-t1-opc-uafx-opcnodeid)<span class="api-meta">static · since v2.8</span> | Unregisters the previously registered (see [RegisterType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertype-t1-opc-uafx-opcnodeid)) type defined by `T` as the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to not longer create for the type definition identified by the `eventTypeId` specified. |

#### UnregisterType&lt;T&gt;()

<span class="api-meta">static · since v2.8</span>

Unregisters the previously registered (see [RegisterType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertype-t1)) type defined by `T` as the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to not longer create for the type definition identified by the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/) defined on the `T` specified.

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

```csharp
public static void UnregisterType<T>() where T : OpcEvent
```

</div>

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

```vbnet
Public Shared Sub UnregisterType(Of T As OpcEvent)()
```

</div>

**Type parameters**

| Name | Description |
|---|---|
| `T` | The [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to unregister for the event definition equals to the event type identifier defined using the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/). |

#### UnregisterType&lt;T&gt;(OpcNodeId)

<span class="api-meta">static · since v2.8</span>

Unregisters the previously registered (see [RegisterType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertype-t1-opc-uafx-opcnodeid)) type defined by `T` as the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to not longer create for the type definition identified by the `eventTypeId` specified.

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

```csharp
public static void UnregisterType<T>(OpcNodeId eventTypeId) where T : OpcEvent
```

</div>

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

```vbnet
Public Shared Sub UnregisterType(Of T As OpcEvent)(eventTypeId As OpcNodeId)
```

</div>

**Type parameters**

| Name | Description |
|---|---|
| `T` | The [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to unregister for the event definition equals to `eventTypeId`. The type needs to be a subclass of the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) class. |

**Parameters**

| Name | Type | Description |
|---|---|---|
| `eventTypeId` | [OpcNodeId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodeid/) | The identifier of the type definition for which the `T` is to be unregistered. |

**Exceptions**

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

### UnregisterTypes

<span class="api-meta">static · 3 overloads · since v2.8</span>

| Overload | Description |
|---|---|
| [UnregisterTypes(Assembly)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#unregistertypes-system-reflection-assembly)<span class="api-meta">static · since v2.8</span> | Unregisters all previously registered types (see [RegisterTypes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertypes-system-reflection-assembly)) in the `assembly` specified. |
| [UnregisterTypes(IEnumerable&lt;Type&gt;)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#unregistertypes-system-collections-generic-ienumerable-of-system-type)<span class="api-meta">static · since v2.8</span> | Unregisters the previously registered (see [RegisterTypes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertypes-system-collections-generic-ienumerable-of-system-type)) `eventTypes` specified. |
| [UnregisterTypes(Type, params Type\[\])](#unregistertypes-system-type-system-type-array)<span class="api-meta">static · since v2.8</span> | Unregisters the previously registered `eventType` and the further specified `eventTypes` (see [RegisterTypes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertypes-system-type-system-type-array)). |

#### UnregisterTypes(Assembly)

<span class="api-meta">static · since v2.8</span>

Unregisters all previously registered types (see [RegisterTypes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertypes-system-reflection-assembly)) in the `assembly` specified.

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

```csharp
public static void UnregisterTypes(Assembly assembly)
```

</div>

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

```vbnet
Public Shared Sub UnregisterTypes(assembly As Assembly)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `assembly` | [Assembly](https://learn.microsoft.com/dotnet/api/system.reflection.assembly) | The [Assembly](https://learn.microsoft.com/dotnet/api/system.reflection.assembly) its types are inspected for subclasses of the [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) class which in addition using the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/). |

**Exceptions**

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

#### UnregisterTypes(IEnumerable&lt;Type&gt;)

<span class="api-meta">static · since v2.8</span>

Unregisters the previously registered (see [RegisterTypes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertypes-system-collections-generic-ienumerable-of-system-type)) `eventTypes` specified.

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

```csharp
public static void UnregisterTypes(IEnumerable<Type> eventTypes)
```

</div>

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

```vbnet
Public Shared Sub UnregisterTypes(eventTypes As IEnumerable(Of Type))
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `eventTypes` | [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[Type](https://learn.microsoft.com/dotnet/api/system.type)&gt; | A sequence of [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) types to unregister for the event definitions equals to the event type identifiers defined using the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/). |

**Exceptions**

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

#### UnregisterTypes(Type, params Type\[\])

<span class="api-meta">static · since v2.8</span>

Unregisters the previously registered `eventType` and the further specified `eventTypes` (see [RegisterTypes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/members#registertypes-system-type-system-type-array)).

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

```csharp
public static void UnregisterTypes(Type eventType, params Type[] eventTypes)
```

</div>

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

```vbnet
Public Shared Sub UnregisterTypes(
    eventType As Type,
    ParamArray eventTypes As Type())
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `eventType` | [Type](https://learn.microsoft.com/dotnet/api/system.type) | The [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) type to unregister for the event definition equals to the event type identifier defined using the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/). |
| `eventTypes` | params [Type](https://learn.microsoft.com/dotnet/api/system.type)[] | An array of additional [OpcEvent](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcevent/) types to unregister for the event definitions equals to the event type identifiers defined using the [OpcEventTypeAttribute](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opceventtypeattribute/). |

**Exceptions**

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

## Events

### TypeResolve

<span class="api-meta">static · since v2.8</span>

Occurs when the resolution of an event type fails. Use this event to manually provide the [Type](https://learn.microsoft.com/dotnet/api/system.type) to use for a specific event type definition identifier.

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

```csharp
public static event OpcTypeResolveEventHandler TypeResolve
```

</div>

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

```vbnet
Public Shared Event TypeResolve As OpcTypeResolveEventHandler
```

</div>

**Event type**

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