static ArrayList AddToList(ArrayList resultCollection, ArrayList newList) {
if (newList == null) {
return resultCollection;
}
if (resultCollection == null) {
return newList;
}
Debug.Assert(resultCollection.Count != 0);
Debug.Assert(newList.Count != 0);
if (! (resultCollection[0] is ArrayList)) {
// Transform resultCollection from ArrayList(XPathNavigator) to ArrayList(ArrayList(XPathNavigator))
Debug.Assert(resultCollection[0] is XPathNavigator);
ArrayList firstList = resultCollection;
resultCollection = new ArrayList();
resultCollection.Add(firstList);
}
resultCollection.Add(newList);
return resultCollection;
}
}