本文整理匯總了C#中BinaryTree.GetEnumerator方法的典型用法代碼示例。如果您正苦於以下問題:C# BinaryTree.GetEnumerator方法的具體用法?C# BinaryTree.GetEnumerator怎麽用?C# BinaryTree.GetEnumerator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BinaryTree
的用法示例。
在下文中一共展示了BinaryTree.GetEnumerator方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TreeWithIntComparer
public void TreeWithIntComparer(int[] arrayCollection, IComparer<int> comparerInt, int[] resut)
{
var tree = new BinaryTree<int>(arrayCollection, comparerInt);
var enumeratorTree = tree.GetEnumerator();
var enumeratorPreorder = resut.GetEnumerator();
while (enumeratorTree.MoveNext() && enumeratorPreorder.MoveNext())
{
Assert.AreEqual(enumeratorTree.Current, enumeratorPreorder.Current);
}
}
示例2: TreeWithBookPreorder
public void TreeWithBookPreorder(Book[] array, Book[] result, IComparer<Book> comparer)
{
var tree = new BinaryTree<Book>(array, comparer);
var enumeratorBook = tree.GetEnumerator();
var enumeratorResult = result.GetEnumerator();
while (enumeratorBook.MoveNext() && enumeratorResult.MoveNext())
{
Assert.AreEqual(enumeratorResult.Current, enumeratorBook.Current);
}
}
示例3: TreeBypassingPreorderWhithDefaultComparer
public void TreeBypassingPreorderWhithDefaultComparer(int[] arrayCollection, int[] preorderArray)
{
var tree = new BinaryTree<int>(arrayCollection);
var enumeratorTree = tree.GetEnumerator();
var enumeratorPreorder = preorderArray.GetEnumerator();
while (enumeratorTree.MoveNext() && enumeratorPreorder.MoveNext())
{
Assert.AreEqual(enumeratorTree.Current, enumeratorPreorder.Current);
}
}