April 2002
Intermediate to advanced
1024 pages
23h 26m
English
Many general-purpose collections are implemented in the .NET Framework SDK. Most of these collections are used as base classes to customize the feature set for an application.
Unlike the Array, an ArrayList can dynamically change its size as new items are added to the collection. Listing B.19 shows an example using an ArrayList (arraylist.cs).
static void Main(string [] args) { ArrayList al = new ArrayList(); lock(al.SyncRoot) { al.Add("This"); al.Add("is"); al.Add("a"); al.Add("test"); al.Add(0); al.Add(1); Console.WriteLine("Sychronized: {0} ", al.IsSynchronized); Console.WriteLine("Read-only: {0} ", al.IsReadOnly); Console.WriteLine("Fixed size: {0} ", al.IsFixedSize); ... |
Read now
Unlock full access