# OpcContext Class

<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">OpcContext Members</a></dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

Provides information and services about the system which belong to the current situation (process, thread, session, etc.).

## Syntax

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

```csharp
public class OpcContext
```

</div>

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

```vbnet
Public Class OpcContext
```

</div>

## Inheritance

[Object](https://learn.microsoft.com/dotnet/api/system.object) → **OpcContext**

## Implements

<ul class="api-implements">
<li><a href="../opc.uafx.iopcnamespaceresolver/">IOpcNamespaceResolver</a></li>
</ul>

## Derived types

- [OpcContext.Local](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext.local/)
- [OpcNodeContext&lt;T&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodecontext-1/)
- [OpcOperationContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcoperationcontext/)

## Properties

| Name | Description |
|---|---|
| [Current](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/members#current)<span class="api-meta">static · since v2.50</span> | Gets or sets the OpcContext for the current thread. |
| [Empty](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/members#empty)<span class="api-meta">static · since v2.9</span> | Gets an empty OpcContext which can be used in cases there a session nor system specific context is not necessarily required. |
| [Identity](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/members#identity) | Gets the [OpcUserIdentity](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcuseridentity/) which belongs to the situation represented. |
| [Namespaces](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/members#namespaces)<span class="api-meta">since v2.12</span> | Gets a read-only collection of namespaces valid in the current OpcContext. |
| [NodeIdFactory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/members#nodeidfactory) | Gets the [OpcNodeIdFactory](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodeidfactory/) used to create new node identifiers using this context. |
| [Owner](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/members#owner)<span class="api-meta">since v2.11</span> | Gets the owner of the current OpcContext. |
| [PreferredLocales](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/members#preferredlocales)<span class="api-meta">virtual · since v2.11</span> | Gets a collection of preferred locales (see [Name](https://learn.microsoft.com/dotnet/api/system.globalization.cultureinfo.name)) to use to localize data and information. |
| [SessionId](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/members#sessionid)<span class="api-meta">virtual</span> | Gets the session identifier which identifies the session within that the context has been created and is valid. |

## Methods

| Name | Description |
|---|---|
| [Enter](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/members#enter)<span class="api-meta">static · 2 overloads · since v2.40</span> | Enters a new OpcContext using the `namespaces` specified. |
| [GetDataType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/members#getdatatype)<span class="api-meta">6 overloads · since v2.22</span> | Retrieves the [OpcDataTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcdatatypeinfo/) object which is known under the `name` specified. |
| [GetNodeType](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/members#getnodetype)<span class="api-meta">4 overloads · since v2.50</span> | Retrieves the [OpcNodeTypeInfo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodetypeinfo/) object which is known under the `name` specified. |
| [OfNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/members#ofnode)<span class="api-meta">since v2.50</span> | Creates a context for the `node` specified which uses the information of the current OpcContext. |

## Applies to

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