Tiny improvement of StringBuilder.Append(StringBuilder)#101020
Tiny improvement of StringBuilder.Append(StringBuilder)#101020tannergooding merged 5 commits intodotnet:mainfrom
StringBuilder.Append(StringBuilder)#101020Conversation
|
Worth an assert to self document? |
My answer would rather be no. Perhaps runtime/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs Lines 2438 to 2446 in fa1164c |
|
If we're making an assumption, we should add an assert to validate that assumption holds true long term. Otherwise, it is trivially possible for a bug to be introduced due to a later refactoring or change. |
|
Also relevant, in some places StringBuilder relies on use of unsafe code such that bounds mistakes could cause and in the past have caused heap corruption. It's another reason to assert assumptions a little more than you might in some other code. |
|
timeouts, let's try again |
it is guaranteed that
m_ChunkLength == 0andm_ChunkChars.Length >= countafterExpandByABlock(count);.