public override object Clone() { object clone; lock (root) { clone = deque.Clone(); } return(clone); }
private static void TestClone(Deque deque) { deque.Clear(); PopulateDequePushBack(deque); Deque deque2 = (Deque)deque.Clone(); Debug.Assert(deque.Count == deque2.Count); IEnumerator d2 = deque2.GetEnumerator(); d2.MoveNext(); foreach(object obj in deque) { Debug.Assert(obj.Equals(d2.Current)); d2.MoveNext(); } }