16
:
, , Visual Studio.Net.
, . . - (generics) , . , , .
.NET , , , , , . . , System.Collections.Generic, System.Collections, System.CoIlections. . 1 .NET (, , , ).
1. .NET 2.0
, .NET 1.0 1.1, , , object:
, , , ;
, .
- , . . ArrayLi st List Monster Daemon.
1. List
1 . (stado) , MonsterL.ib.clll. , Monster, , . , , , , , , . , , , . 1 int , , , . - , , . , -, .
|
|
C#
.NET Framework . , , -. , , .
, .NET Framework 2.0 , System.Collections.Generic, .
- System.Collections System.Collections.Generic.
- ICollection, IComparer, IEnumerable, IList, IDictionary IDictionaryEnumerator .
- , , .
, . , .
System.Collections,System.Collections.Generic System.Collections.Concurrent , , . .
System.Collections , . , . . System.Collections , .
, .
Object, , . , foreach C# , .
Object , , , . Object.
|
|
, List<T> , StringCollection, , , (, StringCollection). , . , .
.
ArrayList
IList .
:System.Collections
: mscorlib ( mscorlib.dll)
ArrayList . ArrayList (, BinarySearch), ArrayList.
ArrayList , ArrayList. ArrayList , . TrimToSize Capacity.
. .
ArrayList null .. .
ArrayList .
using System;
using System.Collections;
public class SampleArrayList {
public static void Main() {
// ArrayList.
ArrayList myAL = new ArrayList();
myAL.Add("Hello");
myAL.Add("World");
myAL.Add("!");
// ArrayList.
Console.WriteLine("myAL");
Console.WriteLine(" Count: {0}", myAL.Count);
Console.WriteLine(" Capacity: {0}", myAL.Capacity);
Console.Write(" Values:");
PrintValues(myAL);
}
public static void PrintValues(IEnumerable myList) {
foreach (Object obj in myList)
Console.Write(" {0}", obj);
Console.WriteLine();
}
}