Thema: Delphi Variant Array verstehen

Einzelnen Beitrag anzeigen

jbg

Registriert seit: 12. Jun 2002
3.481 Beiträge
 
Delphi 10.1 Berlin Professional
 
#2
  Alt 10. Sep 2002, 17:46
Aus der Online Hilfe:
Zitat:
The following example creates a one-dimensional variant array with five elements. Each of the elements are of type Variant, and can therefore contain values of varying types, as is illustrated by the example. Notice in particular how the value of the last element of the array is itself a variant array.
Code:
[b]var[/b]
  A: Variant;
[b]begin[/b]
  A := VarArrayCreate([0, 4], varVariant);
  A[0] := 1;
  A[1] := 1234.5678;
  A[2] := 'Hello world';
  A[3] := True;
  A[4] := VarArrayOf([1, 10, 100, 1000]);
  WriteLn(A[2]);   [i]{ Hello world }[/i]
  WriteLn(A[4][2]);   [i]{ 100 }[/i]
[b]end;[/b]
Daraus erschließe ich, dass du nur Data[xyz] schreiben musst, um auf die Elemente zugreifen zu können.
  Mit Zitat antworten Zitat