User Tools

Site Tools


net_array

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
net_array [2018/02/12 19:01] wolfgangriedmannnet_array [2018/05/31 03:52] wolfgangriedmann
Line 28: Line 28:
 endif endif
 return false</code> return false</code>
 +
 +There are two different types of multidimensional arrays with different syntax:
 +The jagged arrays or arrays of arrays:
 +<code>local aJagged as string[][]
 +
 +aJagged := <string[]>{ <string>{ "X#", "xsharp.info" }, <string>{ "C#", "microsoft.com" } }
 +System.Console.WriteLine( aJagged[0][0] )</code>
 +The jagged arrays are more efficient, but have a (for xBase users) strange syntax to access the members.
 +There are also multidimensional arrays:
 +<code>local aMulti as string[,]
 +
 +aMulti := string[,]{2,2}{ <string>{ "X#", "xsharp.info" }, <string>{ "C#", "microsoft.com" } }
 +System.Console.WriteLine( aMulti[0,0] )</code>
 +Of course you can use them also in more than 2 dimensions.
  
 In the daily coding the [[collections|Collections]] are much more important, because they can be resized. In the daily coding the [[collections|Collections]] are much more important, because they can be resized.
Line 34: Line 48:
  
 The VO dynamic arrays pay a high price for their flexibility: every member is an usual (with the known overhead at runtime and in memory) and therefore any type checking must be done at runtime by the programmers code (for the .NET arrays the compiler does these checks). The VO dynamic arrays pay a high price for their flexibility: every member is an usual (with the known overhead at runtime and in memory) and therefore any type checking must be done at runtime by the programmers code (for the .NET arrays the compiler does these checks).
 +But the X# runtime (ready from June 2018) introduces typed arrays, so you can have both: the flexibility of the VO array and the compiler checks of the .NET array.
  
-You can find more help in the MSDN page [[https://docs.microsoft.com/en-us/dotnet/api/system.array|System.Array]]+You can find more help informations about .NET arrays in the MSDN page [[https://docs.microsoft.com/en-us/dotnet/api/system.array|System.Array]]
  
  
net_array.txt · Last modified: 2018/09/09 04:20 by wolfgangriedmann