public static void PerformActionOnAllArrayListWrappers(ArrayList arrList, Action<ArrayList> action)
{
// Adapter, GetRange, Synchronized, ReadOnly returns a slightly different version of ArrayList.
// The following variable contains each one of these types of array lists
ArrayList[] arrayListTypes =
{
(ArrayList)arrList.Clone(),
(ArrayList)arrList.GetRange(0, arrList.Count).Clone(),
(ArrayList)ArrayList.Adapter(arrList).Clone(),
(ArrayList)ArrayList.FixedSize(arrList).Clone(),
(ArrayList)ArrayList.ReadOnly(arrList).Clone(),
(ArrayList)ArrayList.Synchronized(arrList).Clone()
};
foreach (ArrayList arrListType in arrayListTypes)
{
action(arrListType);
}
}