# EndpointDescriptionExtensions Members

> Reference: Provides extension methods to get and set the address and the security policy of an EndpointDescription.

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

## Methods

### GetAddress

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

Gets the URL of the `endpoint` specified.

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

```csharp
public static Uri GetAddress(this EndpointDescription endpoint)
```

</div>

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

```vbnet
Public Shared Function GetAddress(endpoint As EndpointDescription) As Uri
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `endpoint` | <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.EndpointDescription">EndpointDescription</abbr> | The endpoint whose URL is to be returned. |

**Returns**

[Uri](https://learn.microsoft.com/dotnet/api/system.uri)

The URL of the `endpoint`, or a null reference (Nothing in Visual Basic) if its URL is not an absolute URI.

**Exceptions**

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

### GetEndpointPolicy

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

Gets the security policy of the `endpoint` specified.

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

```csharp
public static OpcSecurityPolicy GetEndpointPolicy(
    this EndpointDescription endpoint)
```

</div>

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

```vbnet
Public Shared Function GetEndpointPolicy(
    endpoint As EndpointDescription) As OpcSecurityPolicy
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `endpoint` | <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.EndpointDescription">EndpointDescription</abbr> | The endpoint whose security policy is to be returned. |

**Returns**

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

A new [OpcSecurityPolicy](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicy/) using the security mode and the security algorithm of the `endpoint`.

**Exceptions**

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

**Remarks**

A security policy URI of the endpoint which is not one of the algorithms of [OpcSecurityAlgorithm](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecurityalgorithm/) results in the algorithm [None](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecurityalgorithm/#none).

### SetAddress

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

Sets the URL of the `endpoint` to the `address` specified.

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

```csharp
public static void SetAddress(this EndpointDescription endpoint, Uri address)
```

</div>

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

```vbnet
Public Shared Sub SetAddress(endpoint As EndpointDescription, address As Uri)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `endpoint` | <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.EndpointDescription">EndpointDescription</abbr> | The endpoint whose URL is to be set. |
| `address` | [Uri](https://learn.microsoft.com/dotnet/api/system.uri) | The new URL of the endpoint, or a null reference (Nothing in Visual Basic) to remove the URL. |

**Exceptions**

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

### SetEndpointPolicy

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

Sets the security mode and the security policy URI of the `endpoint` to those of the `endpointPolicy` specified.

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

```csharp
public static void SetEndpointPolicy(
    this EndpointDescription endpoint,
    OpcSecurityPolicy endpointPolicy)
```

</div>

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

```vbnet
Public Shared Sub SetEndpointPolicy(
    endpoint As EndpointDescription,
    endpointPolicy As OpcSecurityPolicy)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `endpoint` | <abbr title="OPC Foundation stack type, not documented here: Opc.Ua.EndpointDescription">EndpointDescription</abbr> | The endpoint whose security policy is to be set. |
| `endpointPolicy` | [OpcSecurityPolicy](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicy/) | The security policy to use. |

**Exceptions**

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