We're developing a performance-sensitive text serialization class, and we'd like to avoid converting value-types into reference-types wherever possible.
The String.Insert
method appears to require you to provide a string parameter, and does not have an overload allowing a single character to be passed in as a value-type.
We're running into this scenario quite frequently, so I want to make sure there isn't another way to accomplish this without converting the character into it's own string, and then passing it to String.Insert
We've considered treating the parent string as a basic array, and inserting a single character from that angle - but this doesn't seem to work either (unless we're doing something wrong).
The major problem with this approach, is that it appears to require us to use the String.AsCharArray
method, which produces a copy of the string as a separate reference object - which is what we're trying to avoid in the first place.