By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,269 Members | 1,509 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,269 IT Pros & Developers. It's quick & easy.

Dynamic array

P: n/a
Hello.
I need to create dynamic array, like: "int[,] myArray = new int[,]" and
"int[] myArray2 = new int[]"
How can I do this? In Delphi it's very simple, but I don't know how can
I do this in C#.

Can anyone help mi with this?
greetings, gregory.
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Sun, 11 Apr 2004 20:20:06 +0200, rozrabiak <br**@maila.pl> wrote:
Hello.
I need to create dynamic array, like: "int[,] myArray = new int[,]" and
"int[] myArray2 = new int[]"


int [] myArray = new int [10];

This declares a 10-element array of integers.
If you later need to change the size, you can simply write

myArray = new int [20];

You then have a 20-element array of integers. The garbage collection
routines take care of releasing the memory used by the original
10-element array.

--
Duncan
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.