/// <summary> /// Extracts the inner list from the System.Collections.CollectionBase. /// </summary> /// <param name="collection">The collection base to extract from.</param> /// <returns>An array list that is the inner list for a collection base object.</returns> public static System.Collections.ArrayList GetInnerList(System.Collections.CollectionBase collection) { // check to see if collection object is null if (collection == null) { throw new ArgumentNullException("collection", "Unable to extract the inner list for a null collection."); } // declare the property member array PropertyInfo[] proparray; // get the object type Type objtype = collection.GetType(); // Get the properties of the collection proparray = objtype.GetProperties(BindingFlags.NonPublic | BindingFlags.Instance); // create a return variable for the inner list. System.Collections.ArrayList innerlist = null; // get the inner list for (int i = 0; i < proparray.Length; i++) { if (proparray[i].Name == "InnerList") { innerlist = proparray[i].GetValue(collection, null) as System.Collections.ArrayList; break; } } // return the inner list return(innerlist); }