C# ArrayList FixedSize(ArrayList)

Description

ArrayList FixedSize(ArrayList) returns an ArrayList wrapper with a fixed size.

Syntax

ArrayList.FixedSize(ArrayList) has the following syntax.


public static ArrayList FixedSize(
  ArrayList list
)

Parameters

ArrayList.FixedSize(ArrayList) has the following parameters.

  • list - The ArrayList to wrap.

Returns

ArrayList.FixedSize(ArrayList) method returns An ArrayList wrapper with a fixed size.

Example

The following code example shows how to create a fixed-size wrapper around an ArrayList.


/*from www  .j  a va  2s .  c  o m*/
using System;
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 »
    System.Collections »




ArrayList
BitArray
Comparer
Hashtable
Queue
SortedList
Stack