Upgrade

/// <summary>
        /// Converts an arraylist to a generic List
        /// </summary>
        /// <typeparam name="T">The type of the elements in the arraylist</typeparam>
        /// <param name="l">The arraylist</param>
        /// <returns></returns>
        public static List<T> Upgrade<T>(this ArrayList l)
        {
            var list = new List<T>();

            foreach (T entry in l)
            {
                list.Add(entry);
            }

            return list;
        }
Example:
 ArrayList l = new ArrayList();
 l.Add("a");
 l.Add("b");

 var list = l.Upgrade<string>();

Description

Upgrades an ArrayList to a generic List

Details

Double click on the code to select all.

 

;