A long-time mistake of mine: Trying to type standard arrays like this:
var arr = new Array(int); //stupid – standard arrays can’t be typed
This is very wrong, as it puts the Type Int32 into the newly created array which of course causes problems once you’re trying to get to all those other ints that you stored in the array. So everytime I tried to use this I had to come up with some other solution in the end… converting back and forth from standard to builtin, etc…
The correct way is of course to just create the Array with var arr = new Array(); – then fill it and once you’re trying to use the contents you type each value as you take it out of the array…
Builtin-Arrays on the other hand are typed, so if you don’t need the extra functionality and flexibility, just do it this way:
var posGridA = new int[7]; //builtin arrays are typed!
- Thanks to NCarter for enlightening me!