Use Microsoft’s Reference Source To View .NET’s Original Code

One of that great things about .NET is that inspecting compiled code is simple — fire up your IL (Intermediate Language) disassembler of choice, crack open the library in question and as long as it’s not obfuscated, you can see a very close interpretation of the source.

If it’s Microsoft’s own libraries you want to check, you can do better — the company’s Reference Source site, which includes the original comments and unaltered code for all the base DLLs.

The disadvantage of IL dissemblers is that you don’t get comments — they’re obviously ignored at compile time — and compiler optimisations can make it a little harder to discern what’s going on.

With Microsoft’s Reference Source, it’s the same code that gets put into the compiler. On top of this, most classes, including HashSet above, are well-documented so it’s great as a learning tool also.

The difference between Reference Source and say, viewing CoreFX on GitHub is that the former is much, much easier to search. Still, if you actually want to use the source in some form, grabbing it via GitHub is the better way to go.

Reference Source [Microsoft]


The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.

Comments