by danbruc · 1y ago · 0 comments
// This also supports multidimensional arrays, that is why the parameters are arrays.
var array = Array.CreateInstance(elementType: typeof(Int32), lengths: [ 5 ], lowerBounds: [ -2 ]);
// This does not compile, the type is Int32[*], not Int32[].
// Console.WriteLine(array[0]);
array.SetValue(value: 42, index: -2);
Console.WriteLine(array.GetValue(-2));