While developing with Java in Eclipse it was very handy: you can attach sources and explore core java code just like your own. In Visual Studio I know about watching at the .net source code is possible only when debugging (and I can't say this feature works well).
Are there any alternatives of exploring .net source code?
views:
106answers:
6You can look at the Mono source code.
Mono is an open source implementation of the CLR and many base class libraries.
As for the Microsoft ones - they are proprietary, so any access to them is determined by Microsoft. As you have seen, debugging is one way of doing so and some companies have signed NDAs with Microsoft that allow them to see the source (an unlikely option for any individual, unfortunately).
Having said that, some libraries are available to download (provided you agree to the EULA), as @Hemant says in his answer.
Another option (since all of the .NET library code is compiled to IL) is to use a tool like Reflector to see a disassembled version (it will not give you the original C#, but a best effort decompilation).
you can see the source code from the tool called Reflector. Some companies obfuscate their DLLs(for security reasons) in which case Reflector will unable to show source code.
Using ReSharper you can do "Go to Declaration" directly from within visual studio and it will take you the actual, original source code that is not part of your solution. It works both while debugging and in normal mode. It doesn't just work for the .NET source it works for any assemblies that you have pdbs for (given that the source code is anywhere on your disk or in your network).
In conjunction with the ReflectorNavigator PowerToy "Go to Declaration" even works for assemblies that you neither have the source code nor the pdbs for. It will use reflector behind the scenes to decompile the assembly and presents you the source code directly in visual studio.
Here is an article that discusses all that.
You should take a look at Reflector which allow you to read bytecode compiled .NET assemblies. It's a mandatory tool for any .NET developper ;)
Source code of many .NET framework libraries is available for download. It is released under reference license so you can certainly browse through code.
Also refer this and this blog post about how to setup visual studio to step-in while debugging.