S
Sudip_inn
Guest
i have treeview which has many nodes and nested nodes. how could i iterate in all the nodes in foreach loop ?
i was following this way
foreach (var node in Collect(tvCsmTuner.Nodes))
{
}
IEnumerable<TreeNode> Collect(TreeNodeCollection nodes)
{
foreach (TreeNode node in nodes)
{
yield return node;
foreach (var child in Collect(node.Nodes))
yield return child;
}
}
i do not want to use this Collect() function rather i want to use normal foreach to iterate in all the nodes ?
thanks
Continue reading...
i was following this way
foreach (var node in Collect(tvCsmTuner.Nodes))
{
}
IEnumerable<TreeNode> Collect(TreeNodeCollection nodes)
{
foreach (TreeNode node in nodes)
{
yield return node;
foreach (var child in Collect(node.Nodes))
yield return child;
}
}
i do not want to use this Collect() function rather i want to use normal foreach to iterate in all the nodes ?
thanks
Continue reading...