I love Reflector, but sometimes I want to be able to explore through the Framework in more interesting ways. In this post I am going to use the program that I created last time to do some exploring.

How many types are there in the 2.0 version of the framework? Just click Go:
15834 – Wow! [Update: After 3.5 SP1 - 16375]

How many instances of the Async pattern are there in the .NET Framework? There are a bunch of ways to do this one. One way was shown in the picture last time.
Select Method, type ^Begin, press Add, select ParameterType, type AsyncCallback, press And, and click Go
831 [Update: 857]  The Name textbox uses regular expressions so the caret (^) before the word Begin just means that it should only match methods that start with Begin, rather than anywhere in the name (which is the default).

Looking through those it seems that lots of those are the possibly CPU bound delegate BeginInvoke pattern. Let’s filter out the delegates Leaving the expression the way it was last time add:
Select Inherits, type Delegate, check Not (checkbox), press And, and click Go:
233 [Update: 247]
So I guess that means there are about 600 delegates? I will double check that in one second.

First it looks like a lot of the instances of the async pattern that are left inherit from Stream, lets filter those out as well. Again leaving the expression the way it is:
Select Inherits, type Stream, check Not (checkbox), press And, and click Go:
68 [Update: 76] and one of those is Stream itself. Go ahead and have a look – the ones left have a lot of diversity: SqlCommand, LdapConnection, Dns lookup, WebRequest, HttpListener, tons of Socket stuff, MSMQ, .NET Remoting, System.Transactions, and HttpAsyncHandler. All provided for you free of charge in the .NET framework itself.

Now lets go back to those delegates:
Press Clear, select Inherits, type Delegate, and click Go:
595 [Update: 607] – close enough that I believe it :)

Another question that I wanted answered was what are the generic delegates? Leaving the expression the way it is:
Select Type, type `(backtick), and click Go. The backtick is the way that generic types are represented in the IL. Here we see a really small list, but all of them are extremely useful: Action ,Predicate, Comparison, Converter, etc.


I played around a little more and found lots of other oddities. For example: I was searching for Trees and I found an RBTree in the System.Data assembly – WTF? I have attached the finished project – happy hunting!

No comments yet.

No Comments »

You must be logged in to post a comment.