Dynamic array creation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I've an array of my own Class.The size of the array is varying. I need to include one element to the array as and when it is needed. Is there any way in C#? I've heard about the Assembly.CreateInstance(). Is this the only way out?

Thanks in advance.
ARZ.
 
Hi ARZ,

..NET arrays are immutable. If you want to add a new item you have to create
a new array and copy items from the old one.

If you want dynamic array-like collection take a look at ArrayList class

--
B\rgds
100

ARZ said:
Hi,
I've an array of my own Class.The size of the array is varying. I need to
include one element to the array as and when it is needed. Is there any way
in C#? I've heard about the Assembly.CreateInstance(). Is this the only way
out?
 
Back
Top