How to create a multidimensional array of a certain type in runtime?

  • Thread starter Thread starter Norbert Pürringer
  • Start date Start date
N

Norbert Pürringer

Hello,

does anyone know, if it is possible (via reflection?) to instantiate a
multidimensional array of a certain type, which is first known at run
time?

e.g. at runtime I have to create an array of type string[2,3]. The
type string is given by a variable of type Type. So the input
parameter are Type, Cols and Rows.

Any ideas how to realize it?

Thank you,
Norbert
 
does anyone know, if it is possible (via reflection?) to instantiate a
multidimensional array of a certain type, which is first known at run
time?

e.g. at runtime I have to create an array of type string[2,3]. The
type string is given by a variable of type Type. So the input
parameter are Type, Cols and Rows.

Any ideas how to realize it?

See Array.CreateInstance(Type, int[])

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top