ToVariantArray: Array;
The ToVariantArray method creates a new array by converting the source array into the array with the Variant type.
Sub UserProc;
Var
arrD: Array[3] Of Double = [1.0, 2.0, 3.0];
arrS: Array[2, 2] Of String = [["AA", "AB"], ["BA", "BB"]];
arrV1, arrV2: Array Of Variant;
Begin
arrV1 := arrD.ToVariantArray;
arrV2 := arrS.ToVariantArray;
Debug.WriteLine(arrV1.Length);
Debug.WriteLine(arrV2.Length);
End Sub UserProc;
After executing the example, two arrays with the Double and String types are converted to the array with the Variant type. Sizes of output arrays will be displayed in the development environment console.
See also: