Is there any way to see the source code for methods that are implemented externally in the .NET framework?
I know about Reference Source which is a great resource, however a lot of the core classes in the .NET framework are implemented externally (I assume in C++?).
For example I am very interested in the internal workings of of the class String but almost half of the methods are declared with the extern keyword including this[int index]
which appears to actually hold the characters in the string.
Where can I find the source code for String.this[int index]
or String.nativeCompareOrdinalEx(String strA, int indexA, String strB, int indexB, int count)
and other externally implemented methods?
Also, is there a particular reason why so much of the core framework classes are implemented externally? Is it so that they could utilize existing code or for performance reasons or something else?
You can open code into Visual Studio in the following ways: On the Visual Studio menu bar, choose File > Open > Folder, and then browse to the code location. On the context (right-click) menu of a folder containing code, choose the Open in Visual Studio command.
You can use command-line compilers or Visual Studio to create a single-file assembly that targets the . NET Framework. By default, the compiler creates an assembly file with an .exe extension. Visual Studio for C# and Visual Basic can be used only to create single-file assemblies.
For the new, community, version you can dig in the github, that's where I found the implementation of decimal subtraction (or were I was pointed to by SO in fact)
CoreCLR / src
You have roslyn code there too:
Roslyn at Github
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With