This is a copy, and you cannot have a string reference to part of another string. The .net string is not supported by the array; it contains an inline char string. those. it is a variable-length class similar to an array.
While this subreference model is a possible implementation (I think java strings are just fragments in char arrays), this can lead to strange behavior when storing a small substring keeps the entire string in memory, a common error with java substrings. I think .net developers wanted to avoid such problems.
You can use your own type string that has this property. For example, you can work with slices into a char array with ArraySegment<char> .
source share