views:

86

answers:

3

I would like to look at the code for some of the classes in the .NET library. I find functions by using intellisense and just reading the tooltips that come up when I select different items.

One example is the Contains method that you can use on arrays to search for a given string. I just happened to stumble upon that while working on an exercise to learn. I'm assuming it's a simple method that just iterates through the array and checks for the string at each element.

If I wanted to take a look at this code, or code for any other class in .NET, how would I go about it? I have Visual Studio 2008.

+10  A: 

Use .NET Reflector

Adam Robinson
The one and only answer... basically ;)
Lucero
@Lucero: Not the only...
Mehrdad Afshari
Well, since the question asks for "code for any other class in .NET", the framework symbols or source will not help much. Also, looking at Rotor sources can be misleading since the actual BCL implementation may differ.
Lucero
Can't beat this answer!
Stevo3000
A: 

Reflector is the way to go.

.NET Framework 3.5 BCL source code is available through debug symbols (reference license).

SSCLI (Rotor) and Mono source code can be relevant too.

Mehrdad Afshari
+1  A: 

Either Reflector (for ease of use and universal application) or Microsoft's symbol server for the real thing.

ShuggyCoUk