TreeNodeCollection, like some of the other control collections in System.Windows.Forms, implements IEnumerable. Is there any design reason behind this or is it just a hangover from the days before generics?
From stackoverflow
Sean Kearon
-
Yes, Windows Forms dates back to before generics in .Net
From Luke Halliwell -
Yes, there are many .NET Framework collection, that does not implement generic IEnumerable.
I think that's because after 2.0 there was no (at least not so match) development of the core part of FW.
Meanwhile I suggest you to make use of following workaround:
using System.Link; ... var nodes = GetTreeNodeCollection().OfType<TreeNode>();From Artem Tikhomirov
0 comments:
Post a Comment