Generics rocks; coming from a C++ background it wasn't until .NET was blessed with generics (v2.0) that I began taking it seriously. Without at least some form of
parametric polymorphism any programming language is simply hobbled.
Once the almighty
Anders got around to giving us generics however, things were all rosy. I could safely (and speedily!) add and remove typed objects to my lists, write generic methods to perform operations and, generally, genericise the hell out of my code. Sure, it wasn't as powerful as C++'s templates but generics are easier to use and have their own advantages (side-stepping the code bloat issue and providing an easy way to package a generic library for example). Anyhoo, I'm using generics and I'm a happly lil' developer.
Until I try to derive from a WinForms control and create a generic class from it.
"Ohh noo, you can't do that!" complains the Visual Studio designer. "Of course I can" I reply (surely I'm not the only developer who talks to their computer?) as I scan the code for errors. There are none; the code compiles and even runs just fine. All I wanted was a type-safe CheckedListBox and generics are the perfect solution. Unfortunately the
designer doesn't know how to deal with generic classes. If you create one, that's fine - but try to
use it at design-time and you're in deep poo-poo. Bugger, it has a lot of great uses...
Anyone know any way around this limitation? And, for bonus points, do you know
why that limitation is there (seems to me - with cursory thought - that there's no good reason for the limitation to exist)?