Reflection and Arrays

  • Thread starter Thread starter alexandre jenny
  • Start date Start date
A

alexandre jenny

Hi,

Just one small question about reflection :

- Let's have an ordinary Type, stored in refType variable (the type isn't an
array).
How can I instanciate an array of this Type ? Should I really find the type
for the array before ?
(I can instanciate the object by using activator, but an array of ... )

Alexandre
 
Hi alexandre,

For creating arrays you should use Array class itself.

Look at the Array.CreateInstance method.
 
Thanks,
Simple in fact when known ...

Alexandre

Stoitcho Goutsev (100) said:
Hi alexandre,

For creating arrays you should use Array class itself.

Look at the Array.CreateInstance method.

--
HTH
Stoitcho Goutsev (100) [C# MVP]


alexandre jenny said:
Hi,

Just one small question about reflection :

- Let's have an ordinary Type, stored in refType variable (the type
isn't
an
array).
How can I instanciate an array of this Type ? Should I really find the type
for the array before ?
(I can instanciate the object by using activator, but an array of ... )

Alexandre
 
Back
Top