Inconsistencies in .NET 2.0 (Build 40301)

So over the past 48 hours, I've been really diving into the Framework 2.0, looking at how the Provider Model is architected and implemented. There is one point that kind of confuses me, and I'm hoping that since there are so many Microsoft voices here, someone can give me an answer.

I expected that a lot of the new code would be using Generics instead of Collections, because I thought that collection programming was one of the primary reasons for using Generics. Is this not the case? Just out of curiosity, why are there still so many parts of 2.0 that are not using Generics?

Also, I was snooping around, and there are still several places in the Framework that are not using the new TryCast keyword. They are still doing redundant type-checking before casting objects, i.e:

1Dim MyOtherObject as SomeBaseType

2If TypeOf o Is SomeDerivedType
3 MyOtherObject = DirectCast(o, SomeDerivedType)
4 If Not MyOtherObject Is Nothing Then
5 'Do Something
6 Else
7 Throw New YouScrewedUpException("You call yourself a programmer?")
8 End If
9End If
(I think that code is right). Anyways, it was just confusing for me. I would be curious to know what kind of communication there is between teams on what new features are going to be in the Framework, and how API design is standardized across the project. Is standardization a part of the stabilization and performance phases of the MSF model? If so, is there one final scrub of all the APIs before release?

3 Comments

  • When last I checked there were guidelines that any API that used generics should also provide non-generic versions of the method so it could be used from languages that didn't support generics. I don't know if this policy has changed but I didn't see the point of doubling my API surface area for what is effectively syntactic sugar so I didn't use generics in any of the APIs I was designing for Whidbey.



    I have no idea about about other teams in Whidbey.

  • Yes, it's very simple, generics are not yet CLS compliant, so no API will expose generics until that's the case.

  • One thing I would add is that there's also a question of ordering that frequently enters into this equasion. When a feature like TryCast gets checked in, it can take a while before tools that support it get accepted to be used to build the frameworks. We also miss things sometimes, too, so feel free to point out places where it looks like we could do things better!

Comments have been disabled for this content.