Create a fix-sized ArrayList from an existing ArrayList in CSharp

Description

The following code shows how to create a fix-sized ArrayList from an existing ArrayList.

Example


using System;//from  w ww. ja  v  a  2 s. co  m
using System.Collections;
public class SamplesArrayList  {

   public static void Main()  {
      ArrayList myAL = new ArrayList();
      myAL.Add( "A" );
      myAL.Add( "B" );

      ArrayList myFixedSizeAL = ArrayList.FixedSize( myAL );

      Console.WriteLine(myAL.IsFixedSize);
      Console.WriteLine(myFixedSizeAL.IsFixedSize);

   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Collections »




ArrayList
BitArray
Collection
Comparer
HashSet
Hashtable
LinkedList
List
ListDictionary
OrderedDictionary
Queue
SortedList
SortedSet
Stack
StringCollection
StringDictionary