jknielse
jknielse

Reputation: 751

Dynamic Array Dimensions

I'm in need of a multidimensional array such that the number and size of the dimensions are specified at runtime. For example, I might end up with a

double[,] array;

or I might end up with a

double[,,,] array;

but I wont know until runtime.

Upvotes: 2

Views: 338

Answers (1)

Reed Copsey
Reed Copsey

Reputation: 564333

You can use Array.CreateInstance to build this array, but you can't have it strongly typed in code. Instead, you will need to use Array.Rank, Array.GetLowerBound, and Array.GetUpperBound to work with the array.

Upvotes: 4

Related Questions