本文整理汇总了C#中TreeNode.SelectDepthFirst方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.SelectDepthFirst方法的具体用法?C# TreeNode.SelectDepthFirst怎么用?C# TreeNode.SelectDepthFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode
的用法示例。
在下文中一共展示了TreeNode.SelectDepthFirst方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectDepthFirst_ChildrenSelectorNull
public void SelectDepthFirst_ChildrenSelectorNull ()
{
var root = new TreeNode<int>[0];
Func<TreeNode<int>, IEnumerable<TreeNode<int>>> childrenSelector = null;
root.SelectDepthFirst (x => x.Value, childrenSelector);
}
示例2: SelectDepthFirst
public void SelectDepthFirst ()
{
#region SelectDepthFirst
TreeNode<int>[] root = new TreeNode<int>[] {
new TreeNode<int> {
Value = 1, Children = new [] {
new TreeNode<int> { Value = 2 },
new TreeNode<int> {
Value = 3, Children = new [] {
new TreeNode<int> { Value = 5 },
}
},
new TreeNode<int> { Value = 4 },
}
},
new TreeNode<int> { Value = -1 },
};
IEnumerable<int> values = root
.SelectDepthFirst (x => x.Value, x => x.Children);
AssertAreSame (new[]{ 1, 2, 3, 5, 4, -1 }, values);
#endregion
}
示例3: SelectDepthFirst_ValueSelectorNull
public void SelectDepthFirst_ValueSelectorNull ()
{
var root = new TreeNode<int>[0];
Func<TreeNode<int>, int> valueSelector = null;
root.SelectDepthFirst (valueSelector, x => x.Children);
}