After all the fuss about non-trivial classes becoming obsolete (well, almost), why are .NET compilation classes still not universal? For example, Control.ControlCollection does not implement IList<T>, but only IListor FormCollection implements only upto ICollection, not ICollection<T>. Every time I need to do some cool operation, available in the finer points IEnumerable<T>or avail Linq, I have to invariably convert the collection classes to an equivalent general type as follows:
this.Controls.OfType<Control>();
It is strange to point out Controlin such an operation ControlCollectionwhen, the only thing that it can hold is the control again.
Is backward compatibility maintained, given that these collections existed in .Net for 1.1 days? Even if this is so, why these sets (many of them are many) do not contain additional interfaces along with the existing ones, which, in my opinion, will not violate backward compatibility. I'm not sure that I am missing out on the key to generics; maybe I don't understand this idea.
Change: . Although I asked about this when I had in mind only WinForms, I believe that this applies to newer technologies such as WPF. As @Dennis notes, WPF also has no shared collections. For example, WindowCollection or ItemCollection . WPF was released with .NET 3, but generics was introduced in .NET 2: -o
source
share