<p>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?</p>

[{'answer_id': 37607, 'author': 'Luke Halliwell', 'author_id': 3974, 'author_profile': 'https://Stackoverflow.com/users/3974', 'pm_score': 0, 'selected': False, 'text': '<p>Yes, Windows Forms dates back to before generics in .Net</p>\n'}, {'answer_id': 37609, 'author': 'Artem Tikhomirov', 'author_id': 2313, 'author_profile': 'https://Stackoverflow.com/users/2313', 'pm_score': 4, 'selected': True, 'text': "<p>Yes, there are many .NET Framework collection, that does not implement generic IEnumerable. </p>\n\n<p>I think that's because after 2.0 there was no (at least not so match) development of the core part of FW.</p>\n\n<p>Meanwhile I suggest you to make use of following workaround:</p>\n\n<pre><code>using System.Linq; \n... \nvar nodes = GetTreeNodeCollection().OfType&lt;TreeNode&gt;();\n</code></pre>\n"}]
['https://Stackoverflow.com/questions/37597', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2608/']