AdsConnection.CreateVariableHandleAsync Method

Determines the Symbol handle by its instance path asynchronously.

Namespace:  TwinCAT.Ads
Assembly:  TwinCAT.Ads (in TwinCAT.Ads.dll) Version: 6.0.328+39e3229

Syntax

C#

public Task<ResultHandle> CreateVariableHandleAsync(
    string variableName,
    CancellationToken cancel
)

Parameters

variableName

Type: System.String
Name of the variable.

cancel

Type: System.Threading.CancellationToken
The cancellation token.

Return Value

Type: Task.ResultHandle.
A task that represents the asynchronous 'CreateVariableHandle' operation. The ResultHandle parameter contains the variable handle (Handle) and the ErrorCode after execution.

Implements

IAdsHandle.CreateVariableHandleAsync(String, CancellationToken)

Exceptions

Exception

Condition

ObjectDisposedException

ClientNotConnectedException

Remarks

It is a good practice to release all variable handles after use to regain internal resources in the TwinCAT subsystem. The composite method to this CreateVariableHandleAsync(String, CancellationToken) is the DeleteVariableHandleAsync(UInt32, CancellationToken)

Reference

AdsConnection Class

TwinCAT.Ads Namespace

AdsConnection.DeleteVariableHandleAsync(UInt32, CancellationToken)

AdsConnection.TryCreateVariableHandle(String, UInt32.)

AdsConnection.CreateVariableHandle(String)