本文整理汇总了C#中MindMate.Model.MapNode.SortChildren方法的典型用法代码示例。如果您正苦于以下问题:C# MapNode.SortChildren方法的具体用法?C# MapNode.SortChildren怎么用?C# MapNode.SortChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MindMate.Model.MapNode
的用法示例。
在下文中一共展示了MapNode.SortChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SortChildren_WithRootNodeSortABC_Asc
public void SortChildren_WithRootNodeSortABC_Asc()
{
var r = new MapNode(new MapTree(), "r");
var c1 = new MapNode(r, "C");
var c11 = new MapNode(c1, "c11");
var c12 = new MapNode(c1, "c12");
var c121 = new MapNode(c12, "c121");
var c13 = new MapNode(c1, "c13");
var c131 = new MapNode(c13, "c131");
var c1311 = new MapNode(c131, "c1311");
var c2 = new MapNode(r, "B");
var c3 = new MapNode(r, "C", NodePosition.Left);
var c31 = new MapNode(c3, "c31");
var c32 = new MapNode(c3, "c32");
var c4 = new MapNode(r, "A");
var c5 = new MapNode(r, "F");
var c6 = new MapNode(r, "D");
var c7 = new MapNode(r, "E");
r.SortChildren((node1, node2) => string.CompareOrdinal(node1.Text, node2.Text));
Assert.AreEqual(c4, r.FirstChild);
Assert.AreEqual(c2, r.FirstChild.Next);
Assert.AreEqual(c7, r.LastChild.Previous);
Assert.AreEqual(c5, r.LastChild);
}
示例2: SortChildren_OneChild
public void SortChildren_OneChild()
{
var r = new MapNode(new MapTree(), "r");
var c1 = new MapNode(r, "C");
var c11 = new MapNode(c1, "c11");
var c12 = new MapNode(c1, "c12");
var c121 = new MapNode(c12, "c121");
var c13 = new MapNode(c1, "c13");
var c131 = new MapNode(c13, "c131");
var c1311 = new MapNode(c131, "c1311");
c131.SortChildren((node1, node2) => string.CompareOrdinal(node2.Text, node1.Text));
Assert.AreEqual(c1311, c131.FirstChild);
Assert.AreEqual(c1311, c131.LastChild);
}
示例3: SortChildren
public void SortChildren()
{
var r = new MapNode(new MapTree(), "r");
var c1 = new MapNode(r, "C");
var c11 = new MapNode(c1, "6");
var c12 = new MapNode(c1, "2");
var c13 = new MapNode(c1, "4");
var c14 = new MapNode(c1, "7");
var c15 = new MapNode(c1, "1");
var c16 = new MapNode(c1, "5");
var c17 = new MapNode(c1, "3");
var c121 = new MapNode(c12, "c121");
var c2 = new MapNode(r, "B");
var c3 = new MapNode(r, "C", NodePosition.Left);
var c31 = new MapNode(c3, "c31");
var c32 = new MapNode(c3, "c32");
c1.SortChildren((node1, node2) => string.CompareOrdinal(node1.Text, node2.Text));
Assert.AreEqual(c15, c1.FirstChild);
Assert.AreEqual(c12, c1.FirstChild.Next);
Assert.AreEqual(c11, c1.LastChild.Previous);
Assert.AreEqual(c14, c1.LastChild);
}