You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why can't Substring just have a reference to the original unmanaged memory? Is there something with GC that would prevent a string referencing another string?
The text was updated successfully, but these errors were encountered:
This repo is not very active, so it's not a great place to ask questions like this. A better choice would be the repo for the modern .Net runtime: dotnet/runtime.
That being said, what you're saying would require changing the structure of the string type, which is a pretty fundamental part of the runtime. Instead, .Net decided to add the Span<T> type, which can represent any memory sequence, which means the equivalent operation to Substring, called Slice, works exactly the way you want there.
referencesource/mscorlib/system/string.cs
Line 1302 in dae1427
Why can't
Substring
just have a reference to the original unmanaged memory? Is there something with GC that would prevent astring
referencing anotherstring
?The text was updated successfully, but these errors were encountered: