DotNetObject property indexer set method
WSupported on Windows
|
|
|
|
object[index] = value
Arguments
object
An object returned by the DotNetObject constructor (if the indexer is used on the class) or some other indexed field, property or method return type (for using the indexer on).
value
The value for the array member, which must be an object.
index
The value of the index to use, starting at 0.
Discussion
Calling the indexer set method is similar to setting a member of a single-dimension array based on its index.
If a value type is to be set, you must box it first. The system then attempts to convert the passed type to the destination type for the object’s indexer using the same rules as for DotNetObject.Call. If the conversion fails, an $ERR_INVCAST occurs.
If the indexer type is an object, value must be either ^NULL (to indicate a null object) or an object returned by the DotNetObject constructor, DotNetObject.Call, DotNetObject.GetField, DotNetObject.GetProperty, or the indexer get method. Otherwise, an $ERR_INVCAST error will occur.
Index must be greater than or equal to 1 and less than or equal to the number of elements; otherwise, an $ERR_SUBSCR error will occur.
See Properties and indexers for more information about indexers.
Examples
The example below is similar to setting the string in position 5 of an array to “hello”.
dnObject[5] = "hello"