# IOpcReadNodesService Members

> Reference: Defines a specialized IOpcService<TResponse, TRequest> which can be used to read one or more attributes (see OpcAttribute) of one or more nodes.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">IOpcReadNodesService</a></dd>
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx.services">Opc.UaFx.Services</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 [IOpcService&lt;OpcReadNodesResponse, OpcReadNodesRequest&gt;](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcservice-2/members).

## Properties

### MaxNodesPerRead

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

Gets or sets the maximum number of nodes which shall be read using a single read request. This number indirectly defines the number of requests used to send a specific number of read requests to the server.

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

```csharp
uint? MaxNodesPerRead { get; set; }
```

</div>

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

```vbnet
Property MaxNodesPerRead As UInteger?
```

</div>

**Property value**

[Nullable](https://learn.microsoft.com/dotnet/api/system.nullable-1)&lt;[UInt32](https://learn.microsoft.com/dotnet/api/system.uint32)&gt;

The absolute number of read commands which shall be send to the server per request or a null reference (Nothing in Visual Basic). In case there a specific number of nodes is used, a request with more commands as the [MaxNodesPerRead](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcreadnodesservice/members#maxnodesperread) is partitioned into multiple requests and the responses of them are accumulated. The default value of this property is a null reference (Nothing in Visual Basic) and means that all commands defined are send to the server using the server defined number of nodes per read request.

### UsedMaxNodesPerRead

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

Gets the maximum number of nodes which are read using a single read request. This property will use either the [MaxNodesPerRead](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcreadnodesservice/members#maxnodesperread) or the maximum number of nodes which can be read in one request as defined by the server. The lowest number of nodes is used to partition the commands to execute into multiple read requests.

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

```csharp
uint? UsedMaxNodesPerRead { get; }
```

</div>

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

```vbnet
ReadOnly Property UsedMaxNodesPerRead As UInteger?
```

</div>

**Property value**

[Nullable](https://learn.microsoft.com/dotnet/api/system.nullable-1)&lt;[UInt32](https://learn.microsoft.com/dotnet/api/system.uint32)&gt;

In case there has already been one read attempt (with more than one read command) the definite number of commands per read request; otherwise a null reference (Nothing in Visual Basic).

## Methods

### ReadNodes

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

| Overload | Description |
|---|---|
| [ReadNodes(IEnumerable&lt;OpcReadNode&gt;)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.services.iopcreadnodesservice/members#readnodes-system-collections-generic-ienumerable-of-opc-uafx-opcreadnode) | Reads one or more values of one or more attributes of one or more nodes using the specified `commands`. |
| [ReadNodes(params OpcReadNode\[\])](#readnodes-opc-uafx-opcreadnode-array) | Reads one or more values to one or more attributes of one or more nodes using the specified `commands`. |

**Known results:** [BadNodeIdInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnodeidinvalid), [BadNodeIdUnknown](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnodeidunknown), [BadAttributeInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badattributeinvalid), [BadIndexRangeInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badindexrangeinvalid), [BadIndexRangeNoData](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badindexrangenodata), [BadDataEncodingInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#baddataencodinginvalid), [BadDataEncodingUnsupported](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#baddataencodingunsupported), [BadNotReadable](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnotreadable), [BadUserAccessDenied](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#baduseraccessdenied)

**Exceptions (all overloads)**

| Exception | Condition |
|---|---|
| [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception) | The read service is currently not supported, especially using the `commands` specified. |
| [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) | The service execution failed upon different circumstances; for more details see exception details. The following issues can lead to that exception: [BadNothingToDo](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badnothingtodo), [BadTooManyOperations](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badtoomanyoperations), [BadMaxAgeInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badmaxageinvalid) and [BadTimestampsToReturnInvalid](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/#badtimestampstoreturninvalid). |

#### ReadNodes(IEnumerable&lt;OpcReadNode&gt;)

Reads one or more values of one or more attributes of one or more nodes using the specified `commands`.

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

```csharp
IEnumerable<OpcValue> ReadNodes(IEnumerable<OpcReadNode> commands)
```

</div>

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

```vbnet
Function ReadNodes(
    commands As IEnumerable(Of OpcReadNode)) As IEnumerable(Of OpcValue)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `commands` | [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[OpcReadNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreadnode/)&gt; | A sequence of [OpcReadNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreadnode/) instances to process. |

**Returns**

[IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/)&gt;

A sequence of [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/) instances its number and order of items matches the number and order of items in the `commands` sequence. There is for each command one entry which stores the value requested by that command.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `commands` sequence or one of its items is a null reference (Nothing in Visual Basic). |

#### ReadNodes(params OpcReadNode\[\])

Reads one or more values to one or more attributes of one or more nodes using the specified `commands`.

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

```csharp
IEnumerable<OpcValue> ReadNodes(params OpcReadNode[] commands)
```

</div>

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

```vbnet
Function ReadNodes(
    ParamArray commands As OpcReadNode()) As IEnumerable(Of OpcValue)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `commands` | params [OpcReadNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreadnode/)[] | An array of [OpcReadNode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcreadnode/) instances to process. |

**Returns**

[IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1)&lt;[OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/)&gt;

A sequence of [OpcValue](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcvalue/) instances its number and order of items matches the number and order of items in the `commands` sequence. There is for each command one entry which stores the value requested by that command.

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `commands` array or one of its items is a null reference (Nothing in Visual Basic). |
