|
-
Jan 19th, 2008, 02:08 PM
#1
Thread Starter
Fanatic Member
[3.0/LINQ] add to an existing array
I know this is probably prety noob of me but im having a brain fart
In useing .net 3.0 i want to add to an array in a loop but as it is now i just over write the array each time the loop goes through.
ive been pokeing around and i dont see .add some im wondering what i should be looking for
thanks
-
Jan 19th, 2008, 06:39 PM
#2
Re: [3.0/LINQ] add to an existing array
Arrays are fixed size. If you want to make an array grow you have to create a new array with the desired size and copy all the elements from the existing array to the new one. The Array.Resize method will do that for you but that's not something you should be doing too often. It's quite time consuming, especially with larger arrays. If you want a "dynamic array" then you should be using a List<T>, which exists specifically for the purpose.
-
Jan 19th, 2008, 11:50 PM
#3
Thread Starter
Fanatic Member
Re: [3.0/LINQ] add to an existing array
10-4
thanks I'll give it a try
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|