Question

How to use Get Set properties on arrays in c# scripting.In order to set particular index and to get the value what is the procedure should be followed? I am using Test complete software and c#scripting.

Was it helpful?

Solution

TestComplete's C#Script is actually JScript with square bracket notation instead of dot notation. You can manipulate arrays in C#Script in the same way as in JScript (or JavaScript, which is similar):

// Define an array using an array literal
var names = ["Alice", "Bob", "Charlie"];
Log.Message(names[0]); // "Alice"

// Create and populate an array using a loop
var numbers = new Array(); // or: var numbers = [];
for (var i = 0; i < 5; i++) {
  numbers[i] = i;
}
Log.Message(numbers.join()); // "0,1,2,3,4"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top