Re: int [] Array Question
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Mon, 27 Mar 2006 18:31:05 +0100
Galahad <Galahad@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Ok that makes sense. I can't use an arraylist since the function only takes
int[] as a param.
In that case you should use the ToArray method of either ArrayList or
List<int> after you've created the list.
What is the syntax that I would use inside the loop to add the elements?
You can't add values to an array - arrays are fixed size. You'd have to
reallocate the array on each iteration, which is basically what
ArrayList/List<int> do, except they do it more efficiently by keeping a
buffer of unused entries, only resizing when they need to.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- References:
- Re: int [] Array Question
- From: Jon Skeet [C# MVP]
- Re: int [] Array Question
- Prev by Date: Re: Visual Studio C# Express - MySQL
- Next by Date: Re: emit raw html
- Previous by thread: Re: int [] Array Question
- Next by thread: Re: int [] Array Question
- Index(es):
Relevant Pages
|