tags:

views:

407

answers:

2

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?

A: 

Yes, Windows Forms dates back to before generics in .Net

Luke Halliwell
+3  A: 

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>();
Artem Tikhomirov