Newbies Pay Attention
Ok, this may be common knowledge for most of you, but for the rest listen up:
I spent the past 2 days playing with collections. My opinion: They suck. I can't wait for generics, because there is entrely way too much coding that you have to do to get a collection working. And would there be easy-to-follow samples ANYWHERE about them.... noooo. The closest I came was Darren Nimike's example on ShowUsYourCode. {Darren, a brief note: update to ASP.NET ;) }
So I wanted to be able to access an item in the collection by a value and not by an index. I started by inheriting from CollectionBase, thenĀ I tried overloading my Item property with one that accepts a string, and returns the following information:
List(List.IndexOf(String))
I was of the impression that this would work. It didn't. I didn't really feel like digging around a whole lot more for it, because I'm trying to get GenX.NET wrapped up already, and I just wanted to hold key/value pairs anyways. So I killed all my code, and replaced it with one line underneath my collection definition:
Inherits NameValueCollection
I couldn't be happier. It does exactly what I need it to... no fuss, no mess. The whole collections issue is definitely going to warrant an article. It's just too damned difficult the way it is.