TreeNode tnKey =
treeViewFilters
.Nodes
.Cast<TreeNode>()
.Where(r => r.Text == FilterName)
.ToArray()[0];
The above code is not working. It reports an error
Error 1 Instance argument: cannot convert from 'System.Windows.Forms.TreeNodeCollection' to 'System.Data.EnumerableRowCollection'
Error 2 'System.Windows.Forms.TreeNodeCollection' does not contain a definition for 'Cast' and the best extension method overload 'System.Data.EnumerableRowCollectionExtensions.Cast<TResult>(System.Data.EnumerableRowCollection)' has some invalid arguments
I have taken code from Is there a method for searching for TreeNode.Text field in TreeView.Nodes collection? Any ideas?