public static AprArray Make(AprPool pool, ICollection list, Type type) { if (list is AprArray && ((AprArray)list).ElementType == type) { return(((AprArray)list).Copy(pool)); } else { AprArray a = Make(pool, list.Count, type); IEnumerator it = list.GetEnumerator(); while (it.MoveNext()) { a.Push(it.Current); } return(a); } }
public static AprArray Make(AprPool pool, ICollection list) { if (list is AprArray) { return(((AprArray)list).Copy(pool)); } else { IEnumerator it = list.GetEnumerator(); it.MoveNext(); AprArray a = Make(pool, list.Count, it.Current.GetType()); it.Reset(); while (it.MoveNext()) { a.Push(it.Current); } return(a); } }