Why does .NET create new substrings instead of pointing into existing strings?
问题 From a brief look using Reflector, it looks like String.Substring() allocates memory for each substring. Am I correct that this is the case? I thought that wouldn't be necessary since strings are immutable. My underlying goal was to create a IEnumerable<string> Split(this String, Char) extension method that allocates no additional memory. 回答1: One reason why most languages with immutable strings create new substrings rather than refer into existing strings is because this will interfere with