namespace ConsoleApplication1;
interface
type TCoords = record
fcoords : Inline Array [0 .. 2] Of Integer;
property x : Integer read fcoords[0] write fcoords[0]; property y : Integer read fcoords[1] write fcoords[1]; property z : Integer read fcoords[2] write fcoords[2];
end;
type
Program = class
public
class method getCoords(x,y,z : Integer) : TCoords;
class method Main(args: array of String): Int32;
end;
implementation
class method Program.getCoords(x, y, z : Integer) : TCoords;
begin
result.x := x; // NullReferenceException on .NET
result.y := y;
result.z := z;
end;
class method Program.Main(args: array of String): Int32;
begin
writeLn(SizeOf(TCoords)); // why it is equal to reference (pointer) size?
var c := getCoords(1, 2, 3);
writeLn(c.x);
writeLn(c.y);
writeLn(c.z);
readLn;
end;
end.
This code works on Island but has problems on .NET. Why TCoord on .NET is not static, and why Inline Array (fcoords) also is not static?