Salesforce

.NET Arrays (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

.NET Arrays (Magic xpa 4.x)

A .NET array is similar to the Magic xpa vector. An array is a variable that can hold more than one value of the same type. In contrast with Magic xpa vectors, when working with .NET you need to predefine the number of cells, or elements, that make up the array.

Defining a .NET array is very similar to defining a regular .NET object. To define an array in Magic xpa you add square brackets, [], to the .NET Object Type in the same way that you would in .NET. When defining the array you do not define the size of the array, this is declared when using the object constructor.

Inside the brackets, you enter the number of elements you want to use.

To use DNSet to set the value of an element, you would use something like this: DNSet(H[2],2). .NET arrays start at zero. This means that H[2] is the 3rd element and not the 2nd element. The Magic xpa LoopCounter function starts from 1. Therefore, to set the H[0] element, you need to start from LoopCounter() -1.

In contrast with Magic xpa vectors, after declaring an array, you will not be able to store or retrieve values in elements that are beyond the range you defined. This means that after declaring an array of seven elements you will not be able to set a value in the 8th element. This will cause an exception.

Reference
Attachment 
Attachment