DynamicReferenceInstance.TrySetIndex Method

Provides the implementation for operations that set a value by index. Classes derived from the DynamicObject class can override this method to specify dynamic behavior for operations that access objects by a specified index.

Namespace:  TwinCAT.TypeSystem
Assembly:  TwinCAT.Ads (in TwinCAT.Ads.dll) Version: 4.3.0.0

Syntax

C#

public override bool TrySetIndex(
    SetIndexBinder binder,
    Object[] indexes,
    Object value
)

VB

Public Overrides Function TrySetIndex ( 
    binder As SetIndexBinder,
    indexes As Object(),
    value As Object
) As Boolean

Parameters

binder

Type: System.Dynamic.SetIndexBinder
Provides information about the operation.

indexes

Type: .System.Object.
The indexes that are used in the operation. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the DynamicObject class, indexes[][] is equal to 3.

value

Type: System.Object
The value to set to the object that has the specified index. For example, for the sampleObject[3] = 10 operation in C# (sampleObject(3) = 10 in Visual Basic), where sampleObject is derived from the DynamicObject class, value is equal to 10.

Return Value

Type: Boolean
true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a language-specific run-time exception is thrown.

Reference

DynamicReferenceInstance Class

TwinCAT.TypeSystem Namespace