# OpcSecurityPolicyCollection Class

> Reference: Represents a collection of the security policies of endpoints (see EndpointPolicies).

<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">OpcSecurityPolicyCollection Members</a></dd>
</dl>

Represents a collection of the security policies of endpoints (see [EndpointPolicies](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.server.opcserversecurity/members#endpointpolicies)).

## Syntax

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

```csharp
public class OpcSecurityPolicyCollection
```

</div>

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

```vbnet
Public Class OpcSecurityPolicyCollection
```

</div>

## Inheritance

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

## Implements

<ul class="api-implements">
<li><a href="https://learn.microsoft.com/dotnet/api/system.collections.generic.icollection-1">ICollection</a>&lt;<a href="../opc.uafx.opcsecuritypolicy/">OpcSecurityPolicy</a>&gt;</li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.collections.ienumerable">IEnumerable</a></li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1">IEnumerable</a>&lt;<a href="../opc.uafx.opcsecuritypolicy/">OpcSecurityPolicy</a>&gt;</li>
<li><a href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;<a href="../opc.uafx.opcsecuritypolicy/">OpcSecurityPolicy</a>&gt;</li>
</ul>

## Remarks

The collection compares the security policies by instance: [Contains](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#contains), [IndexOf](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#indexof) and [Remove](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#remove) find a policy only if it has been added to the collection or obtained from it, not an equal policy created separately.

## Constructors

| Name | Description |
|---|---|
| [OpcSecurityPolicyCollection](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#opcsecuritypolicycollection)<span class="api-meta">since v2.6</span> | Initializes a new instance of the OpcSecurityPolicyCollection class, which is empty. |

## Properties

| Name | Description |
|---|---|
| [Count](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#count) | Gets the number of security policies in the collection. |
| [IsReadOnly](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#isreadonly) | Gets a value indicating whether the collection is read-only. |

## Methods

| Name | Description |
|---|---|
| [Add](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#add) | Adds the security policy specified to the end of the collection. |
| [Clear](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#clear) | Removes all security policies from the collection. |
| [Contains](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#contains) | Determines whether the collection contains the security policy specified. |
| [CopyTo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#copyto) | Copies the security policies of the collection to the `array` specified, starting at the `arrayIndex` specified. |
| [GetEnumerator](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#getenumerator) | Returns an enumerator that iterates through the security policies of the collection. |
| [IndexOf](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#indexof) | Determines the index of the security policy specified in the collection. |
| [Insert](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#insert) | Inserts the security policy specified at the `index` specified. |
| [Remove](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#remove) | Removes the security policy specified from the collection. |
| [RemoveAt](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#removeat) | Removes the security policy at the `index` specified. |

## Indexers

| Name | Description |
|---|---|
| [Item](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcsecuritypolicycollection/members#item) | Gets or sets the security policy at the `index` specified. |

## Applies to

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