# OpcCallMethod Members

> Reference: Defines a single command of the IOpcCallMethodsService.

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

Inherits members from [OpcNodeServiceCommand](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcnodeservicecommand/members), [OpcServiceCommand](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.opcservicecommand/members).

## Constructors

### OpcCallMethod

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

| Overload | Description |
|---|---|
| [OpcCallMethod(OpcNodeId, OpcNodeId)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccallmethod/members#opccallmethod-opc-uafx-opcnodeid-opc-uafx-opcnodeid) | Initializes a new instance of the [OpcCallMethod](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccallmethod/) class using the specified `objectId` and `methodId` to call the method without parameters. |
| [OpcCallMethod(OpcNodeId, OpcNodeId, IEnumerable&lt;object&gt;)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccallmethod/members#opccallmethod-opc-uafx-opcnodeid-opc-uafx-opcnodeid-system-collections-generic-ienumerable-of-system-object) | Initializes a new instance of the [OpcCallMethod](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccallmethod/) class using the specified `objectId`, `methodId` and `parameters`. |
| [OpcCallMethod(OpcNodeId, OpcNodeId, params object\[\])](#opccallmethod-opc-uafx-opcnodeid-opc-uafx-opcnodeid-system-object-array) | Initializes a new instance of the [OpcCallMethod](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccallmethod/) class using the specified `objectId`, `methodId` and `parameters`. |

**Exceptions (all overloads)**

| Exception | Condition |
|---|---|
| [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception) | The `objectId` is a null identifier (see [IsNull](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcnodeid/members#isnull)). |

#### OpcCallMethod(OpcNodeId, OpcNodeId)

Initializes a new instance of the [OpcCallMethod](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccallmethod/) class using the specified `objectId` and `methodId` to call the method without parameters.

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

```csharp
public OpcCallMethod(OpcNodeId objectId, OpcNodeId methodId)
```

</div>

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

```vbnet
Public Sub New(objectId As OpcNodeId, methodId As OpcNodeId)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `objectId` | [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 object node or object type node which provides the method. |
| `methodId` | [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 method node to call. |

**Exceptions**

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

#### OpcCallMethod(OpcNodeId, OpcNodeId, IEnumerable&lt;object&gt;)

Initializes a new instance of the [OpcCallMethod](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccallmethod/) class using the specified `objectId`, `methodId` and `parameters`.

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

```csharp
public OpcCallMethod(
    OpcNodeId objectId,
    OpcNodeId methodId,
    IEnumerable<object> parameters)
```

</div>

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

```vbnet
Public Sub New(
    objectId As OpcNodeId,
    methodId As OpcNodeId,
    parameters As IEnumerable(Of Object))
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `objectId` | [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 object node or object type node which provides the method. |
| `methodId` | [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 method node to call. |
| `parameters` | [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[Object](https://learn.microsoft.com/dotnet/api/system.object)&gt; | The values of the input arguments of the method in their order. |

**Exceptions**

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

**Remarks**

The command does not copy the `parameters`; they are enumerated when the command is executed and when [Parameters](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccallmethod/members#parameters) is read.

#### OpcCallMethod(OpcNodeId, OpcNodeId, params object\[\])

Initializes a new instance of the [OpcCallMethod](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccallmethod/) class using the specified `objectId`, `methodId` and `parameters`.

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

```csharp
public OpcCallMethod(
    OpcNodeId objectId,
    OpcNodeId methodId,
    params object[] parameters)
```

</div>

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

```vbnet
Public Sub New(
    objectId As OpcNodeId,
    methodId As OpcNodeId,
    ParamArray parameters As Object())
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `objectId` | [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 object node or object type node which provides the method. |
| `methodId` | [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 method node to call. |
| `parameters` | params [Object](https://learn.microsoft.com/dotnet/api/system.object)[] | The values of the input arguments of the method in their order. |

**Exceptions**

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

**Remarks**

The command does not copy the `parameters`, so that changes of the array are applied to the command.

## Properties

### MethodId

Gets the identifier of the method node to call.

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

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

</div>

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

```vbnet
Public ReadOnly Property MethodId 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 method node to call.

### ObjectId

Gets the identifier of the node which provides the method to call.

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

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

</div>

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

```vbnet
Public ReadOnly Property ObjectId 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 object node or object type node which provides the method.

### Parameters

Gets the values of the input arguments of the method.

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

```csharp
public IEnumerable<object> Parameters { get; }
```

</div>

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

```vbnet
Public ReadOnly Property Parameters As IEnumerable(Of Object)
```

</div>

**Property value**

[IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[Object](https://learn.microsoft.com/dotnet/api/system.object)&gt;

A new array of the values of the input arguments of the method in their order.
