Array.ToSimpleArray

Syntax

ToSimpleArray(Type: ForeVariantType): Variant;

Parameters

Type. Data type of the new array.

Description

The ToSimpleArray method creates a new array by converting the source array with the Variant type into an array with a simple data type.

Comments

To correctly execute the method, values stored in the current array should have the comparable data type, to which the arrays are to be converted.

Example

Sub UserProc;
Var
    arrV1: Array[3Of Variant = [1.02.03.0];
    arrD: Array Of Double;
    arrV2: Array[22Of Variant = [["AA""AB"], ["BA""BB"]];
    arrS: Array Of String;
Begin
    // Convert array with the Variant type to array with th the Double type
    arrD := (arrV1.ToSimpleArray(ForeVariantType.Double)) As Array Of Double;
    Debug.WriteLine(arrD.Length);
    // Covert array with the Variant type to the array with  the String type
    arrS := (arrV2.ToSimpleArray(ForeVariantType.String)) As Array Of String;
    Debug.WriteLine(arrS.Length);
End Sub UserProc;

After executing the example, two arrays with the Variant type and two array with the Double and String types are converted. Sizes of output arrays will be displayed in the development environment console.

See also:

Array