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