November 01, 2005

.NET Generic surprise

So I was looking into Generics a little bit ago. I wasn't interested in writing one, I wanted to see what .NET 2.0 came with. What Generics are the built in to .NET.

After all, this is one of the main selling points of .NET, Microsoft must have a bunch of them in the framework to show how usefull they are. Load 'em up!

Not really. I counted 6. Well, there are a few more, but you have to use other generic classes to use those. Like LinkedList<t>.Enumerator. I didn't count that one.

So here they are. All found in the System.Collections.Generic namespace.
  • LinkedList
  • LinkListNode
  • Queue
  • SortedDictionary
  • SortedList
  • Stack
That is it. Not that I'm complaining about those. I consider those to be the basic classes that have to be there. But Standard Template Library it is not.

Of course, I have no idea what is included with Java 1.5 so I have a hard time comparing with that language. C++ seems to have a template for everything including one for shooting yourself in your foot and every toe.

I guess is comes down to: what was I expecting? What were you expecting? A WinForm or WebForm Generic? Maybe. That is what WTL is all about. But I'm not sure that would be useful in .NET. In WTL, you have to use Templates to do anything. I dont want that here.

So why would I complain. Microsoft made generics for what was really needed. Namely with lists, queues, and collections. Everything else is up to interpretation really.

I guess I was just expecting more. As usual.

1 comment:

unused said...

Generics provide generic lists, queues and collections for use with ANY datatype. So you could have a list of WinForms if you wanted to.

How would a generic specific to WinForm behave differently then the ones you listed?