TreeNode tnKey =
treeViewFilters
.Nodes
.Cast<TreeNode>()
.Where(r => r.Text == FilterName)
.ToArray()[0];
上面的代码不起作用。它报告一个错误
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