Byte arrays ( byte[]in C# ) are used by many .NET classes. In some ways byte arrays might be considered an essential type of .NET. Because of this, CrossTalk automatically generates a byte array wrapper for all CrossTalk projects.This also causes a CTmscorlib.pas file to be generated for all CrossTalk projects, even no types in MSCorlib have been added to the CrossTalk project.

[] are not valid characters in Delphi class names, so byte arrays are named ByteArray. A default property is also automatically added by CrossTalk.

Example Code

procedure TestByteArray;
var
  x: ByteArray;
  i: integer;
begin
  x := ByteArray.Create(5);
  for i := 0 to x.Length - 1 do begin
    x[i] := i;
  end;
  WriteLn(x[2]);
end;