
Signature
Rudy Velthuis http://rvelthuis.de
"The secret of success is to know something nobody else knows."
-- Aristotle Onassis (1906-1975)
As I was saying I do not know how many items there will be in the array, so
I can not specify the size of it, because the size might be 0 and then again
it might be 1 000 000 000 000 items
So is it possble to create an array without defining its size
>> Hi,
>>
[quoted text clipped - 5 lines]
>
> int[] myArray = new int[numItems];

Signature
Thank You in Advance
Merci a l'avance
Martin
Rudy Velthuis - 18 Jan 2008 16:06 GMT
> As I was saying I do not know how many items there will be in the
> array, so I can not specify the size of it, because the size might be
> 0 and then again it might be 1 000 000 000 000 items
Oh, you want it to be able to grow? Use a List<T> instead.
FWIW, you will probably have problems with 1 trillion items, no matter
what data type you choose. <g>

Signature
Rudy Velthuis http://rvelthuis.de
"I think it would be a good idea."
-- Mahatma Gandhi (1869-1948), when asked what he thought of
Western civilization
Martin Racette - 18 Jan 2008 17:18 GMT
Thanks, that was exactly what I was looking for
And the number was just an example <g>
>> As I was saying I do not know how many items there will be in the
>> array, so I can not specify the size of it, because the size might be
[quoted text clipped - 4 lines]
> FWIW, you will probably have problems with 1 trillion items, no matter
> what data type you choose. <g>

Signature
Thank You in Advance
Merci a l'avance
Martin
Willy Denoyette [MVP] - 18 Jan 2008 16:09 GMT
> As I was saying I do not know how many items there will be in the array,
> so I can not specify the size of it, because the size might be 0 and then
> again it might be 1 000 000 000 000 items
>
> So is it possble to create an array without defining its size
This was answered by others, use an ArrayList or Lis<T>, note that you won't
be able to store an array of 1 000 000 000 000 items ever, but I guess you
know that too.
Willy.
Martin Racette - 18 Jan 2008 17:18 GMT
Thanks, that was exactly what I was looking for
And the number was just an example <g>
>> As I was saying I do not know how many items there will be in the array,
>> so I can not specify the size of it, because the size might be 0 and then
[quoted text clipped - 7 lines]
>
> Willy.

Signature
Thank You in Advance
Merci a l'avance
Martin