ToSimpleArray(Type: ForeVariantType): Variant;
Type. Data type of the new array.
The ToSimpleArray method creates a new array by converting the source array with the Variant type into an array with a simple data type.
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.
Sub UserProc;
Var
arrV1: Array[3] Of Variant = [1.0, 2.0, 3.0];
arrD: Array Of Double;
arrV2: Array[2, 2] Of 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: