public bool ForeachLoop() { IEnumerator <Value> b = btB.GetLeaves().GetEnumerator(); foreach (var a in btA.GetLeaves()) { if (!b.MoveNext()) { return(false); } if (a.CompareTo(b.Current) != 0) { return(false); } } if (b.MoveNext()) { return(false); } return(true); }