views:

274

answers:

4

Now that the source code to the .NET Framework has been made available, is there any way to actually view it that doesn't involve using Visual Studio to step into a framework class? Several times now, I've been curious just how something works and wished I could peek at some code, but don't feel like putting together an application and doing an autopsy in the debugger.

My google-fu has failed me, providing me only with blog posts announcing the fact that the source is available. (Thanks, blogosphere!) I was positive that someone would have thrown it all up on the web by now.

+1  A: 

Well, what do you know, two minutes later I tweak my search terms again and find something: NetMassDownloader

Still not quite what I had in mind though...

Brant Bobby
+1  A: 

I was disappointed with how the source code is deployed. I wanted to download and search or browse the code like you.

What I did was install the soure code then copied all the soure code into a separate folder. In my case, H:\CodeLibrary\dotNetSource. I then uninstalled the source code.

The source comes scattered in numerous folders. Therefore, it takes a long time to search, copy, or move. What I did was traversed the folders, moving all the source into one folder. Now searching the source code is easy with Indexing Service or Windows Desktop Search.

For instance, I needed to review the code for TrackBar. I typed "@filename trackbar.cs" in my search utility and bingo.

I cannot tell you how valuable it is to have the source a couple clicks away. When designing, I probably search the source code at least a dozen times a day.

AMissico
+1  A: 

I always just use Reflector - just load a .Net assembly, highlight the class/method you're interested in, hit space and there you go. It puts links in everywhere so you just click a type and it'll take you to the code for that.

It'll be slightly different to the actual source code as it's basically a decompiler, but it's still enough to see how various framework classes work.

Graham Clark
Yeah, I absolutely *love* Reflector, but you don't get the original formatting or comments.
Brant Bobby
Reflector is nice when you want to find out what objects inherit/derived from IDesigner interface.
AMissico
Reflector only shows you the compiled code. Which can be significantly different than the source code. Many times looking at Reflector code is confusing, yet the source code is easily understandable.
AMissico