COMSafeArray.Resize

Syntax:

Resize(<Count>, <LowerBoundary>)

Parameters:

<Count> (required)

Type: Number.
The new number of elements in the first (null) dimension.

<LowerBoundary> (optional)

Type: Number.
The new minimal index value for the first (null) dimension.
Default value: 0.

Description:

Changes the minimum index value in the first dimension of a COMSafeArray and the number of elements in the first dimension. If the new number of elements is greater than the previous number, the old elements COMSafeArray are preserved, and the values of elements added are undefined. When lowering the number of elements, the values of extra elements with the highest index values are lost.
For example, if a COMSafeArray consists of the elements: [0, 0] = 1; [0, 1] = 2; [1, 0] = 3; [1, 1] = 4;
after Resize(3,-1) it will contain: [-1, 0] = 1; [-1, 1] = 2; [0, 0] = 3; [0, 1] = 4; [1, 0] = ?; [1, 1] = ?;
but after Resize(1,2) it will contain: [2, 0] = 1; [2, 1] = 2.

Availability:

Server, thick client, external connection.

Note:

Uses SafeArrayRedim function from Windows API, designed to change the array size. In some Windows versions, change of the index upper limit can be ignored if the number of elements in the array is not changed.

Example:

// For the main index of array the number of elements is set to 10
// and minimal index value is set to -1.
If Array.IsResizable() Then
    Array.Resize(10, -1);
EndIf
;


    

1C:Enterprise Developer's Community