Sunday, March 18, 2007

Building a type-checked dictionary with multiple types...

Chuck has an interesting article on how to use generics to build a dictionary that can hold multiple types (that's the easy part), where you can fetch out the values without casting (that's the clever part.)

I really like the new Dictionary support in 2.0, I've seen a few bugs where folks have accidentally mixed up what was being used as the key in a Hashtable, leading to silent failures to calls to Hashtable.Remove(). Had Dictionary been around at the time, the compiler would have caught these errors since the key was of a different type.

1 comment:

Megan said...

Hey Jess! We are all wondering what is up (or down on the other side of the globe)? We hope you are well and are enjoing life after Microsoft!
Construction is almost done outside, so next party we'll down a beer in your name!
Cheers,
Megan Anderson