Static arrays

Top  Previous  Next

What is translated > Types > Arrays > Static arrays

 

Static arrays can have one or more dimensions. The declarations in C# can be derived from the Delphi declarations in a straightforward manner.:

 

var

  // Define static arrays

  wordArray  : Array[Word] Of Integer;     // Static, size=High(Word)

  multiArray : Array[byte, 1..5] Of char;  // Static array, 2 dimensions

  rangeArray : Array[5..20] Of string;     // Static array, size = 16

 

->

  // Define static arrays

  int[] wordArray = new int[65536/*# word*/];     // Static, size=High(Word)

  char[,] multiArray = new char[256/*# byte*/, 5/*# range   1..  5*/];  // Static array, 2 dimensions

  string[] rangeArray = new string[16/*# range   5..  20*/];     // Static array, size = 16

 

 

While in Delphi the lower bound and the upper bound have to be defined, in C# arrays are always zero based, Array indices are corrected by Delphi2C#.

 

 

 

  



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content