The String
class for older versions should be at http://referencesource.microsoft.com/#mscorlib/system/string.cs. Where can I find the class for .Net Core. And also where can I find StringNative.cpp
which is a base for this?
Both the string and the char[] are stored on the heap - so storage is the same. Internally I would assume a string simply is a cover for char[] with lots of extra code to make it useful for you.
A string is a sequential collection of characters that's used to represent text. A String object is a sequential collection of System. Char objects that represent a string; a System. Char object corresponds to a UTF-16 code unit. The value of the String object is the content of the sequential collection of System.
The String class is defined in the . NET base class library. In other words, a String object is a sequential collection of System. Char objects which represent a string.
In C#, string is a sequence of Unicode characters or array of characters. The range of Unicode characters will be U+0000 to U+FFFF. The array of characters is also termed as the text. So the string is the representation of the text.
All the .NET Core source code is on Github, broken into corefx for the BCL beyond the bits that the CLR really depends on and coreclr for the CLR and the core parts of the BCL (like string).
stringnative.cpp
is the native part of the CoreCLR string implementation, and String.cs
contains the managed code.
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