Official Content

Replaces the element that is in the specified position with the provided element. Returns true if the operation succeeds.

Syntax

&VarCollection1.Set(Numeric Index, Element)

Where:

&VarCollection1
           The collection to which the method is applied to replace the specified element in the specified position.

Numeric Index
           Indicates the position in the collection where you want to replace the existing element with a new element.

Element
           The new element you want to place in the position specified by the Numeric Index.

Type Returned:
Boolean

Scope

Generator: .NET, .NET Framework, JavaAndroid

Samples

1)

// &NumericCollection1 = ("one", "two", "three")
&isOk = &NumericCollection1.Set(1, "newone")

The result is &NumericCollection1 = ("newone", "two", "three")  &isOK=true.

2)

// &NumericCollection1 = ("one", "two", "three")
&isOk = &NumericCollection1.Set(10, "newone")


The result is &NumericCollection1 = ("one", "two", "three")  &isOK=false.

3) 

// &NumericCollection1 = ("one", "two", "three")
&isOk = &NumericCollection1.Set(0, "newone")

The result is &NumericCollection1 = ("one", "two", "three")  &isOK=false.

Availability

This method is available since GeneXus 18 Upgrade 9.

See Also

AddRange method
RemoveRange method

 

Last update: April 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant