Wednesday, May 03, 2006

Cold Cup(Of T)

I often wonder exactly which collection interface I should implement in a new collection class or which I should use as a method parameter. I like to choose the highest level interface that will provide access to the properties and methods I need. Instead of following the links through MSDN Library everytime I quickly created a map in Visio so I can see all the relationships between the standard framework collection interfaces and classes, including the new generic items. It probably isn't complete but I think it is good guide for getting information at a glance.
 
It was interesting to discover the significant differences between the generic and non-generic ICollection interfaces. The original non-generic ICollection provides enumeration support and a Count property. The new generic ICollection(Of T) goes further and includes support for adding and removing items, much more like IList than ICollection. It doesn't even inherit from ICollection which unfortunately means that while most of the standard implementation classes of ICollection(Of T) also implement ICollection, I can't safely pass ICollection(Of T) objects to AddRange methods or common collection constructors.

Deblector arrives

Felice Pollano has just released the first version of the new Deblector addin for debugging within Reflector. It's only alpha at the moment and has some obvious bugs but it is very promising. In the past I have looked at having a Virtual PC with a hacked rebuild of the core framework with debugging enabled. Now I can step into framework code just as easily within the familar Reflector interface. I don't have much experience with IL so I was a little confused at first when multiple lines of IL seemed to execute at once but I quickly realised they all applied to method call setup. I suspect, if possible, we may even be able step through the framework viewed in our chosen language. Keep an eye on this one.