Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I define an array without a fixed size?

I want to define an array without a fixed size.

For example: I have an array with numbers (the user will enter these numbers into the array), and I want to divide it into two arrays. But I don't know ahead of time how many numbers the user will enter.

How can I do this?

like image 911
Arash Avatar asked Dec 28 '10 07:12

Arash


1 Answers

Use a List<T>.

Fall back to an ArrayList if generics are not available on your target platform (e.g. .NET Framework 1.1 and lower).

like image 173
Frédéric Hamidi Avatar answered Sep 21 '22 03:09

Frédéric Hamidi