If you are not in a situation where you must use .NET 1.0 / 1.1 or must interact with legacy code that uses ArrayList, you should really avoid using ArrayListsin new code. Use a generic collection type List<> .
, List<T> .
, Animal, :
Animal dog = new Animal("dog");
Animal cat = new Animal("cat");
List<Animal> animalList = new List<Animal>();
animalList.Add( dog );
animalList.Add( cat );
animalList.Remove( cat );
animalList[0] = new Animal("giraffe");
List<T> ArrayList . , ArrayList object, , .NET .
ArrayList listOfObjects = new ArrayList();
int myAge = 207;
listOfObjects.Add( (object)myAge );
, int ( .NET) . , int ArrayList. ArrayList - List<T>, . , ArrayList . :
listOfObjects.Add( (object)myAge );
listOfObjects.Add( "Hello World" );
. ArrayList , . ArrayList , , , ArrayList, . List<T> , , (, T List<T>).
- . . , .NET/#, - . . . .. , , , . # , . , . , , , - : , , , ..