/// <summary> /// Flattens the tree recursively. /// </summary> /// <param name="flattendNodes">The flattened nodes.</param> /// <param name="depth">The depth.</param> private void FlattenTree(ref Collection <TreeViewNodeFlat> flattendNodes, int depth) { var flat = new TreeViewNodeFlat { Node = this, Depth = depth }; flattendNodes.Add(flat); depth = depth + 1; foreach (var child in this.Children) { var treeViewNode = child as TreeViewNode; if (treeViewNode == null) { continue; } treeViewNode.FlattenTree(ref flattendNodes, depth); } }
/// <summary> /// Flattens the tree recursively. /// </summary> /// <param name="flattendNodes">The flattened nodes.</param> /// <param name="depth">The depth.</param> private void FlattenTree(ref Collection<TreeViewNodeFlat> flattendNodes, int depth) { var flat = new TreeViewNodeFlat { Node = this, Depth = depth }; flattendNodes.Add(flat); depth = depth + 1; foreach (var child in this.Children) { var treeViewNode = child as TreeViewNode; if (treeViewNode == null) { continue; } treeViewNode.FlattenTree(ref flattendNodes, depth); } }