internal unsafe static void memcpyimpl(byte* src, byte* dest, int len) { BCLDebug.Assert(len >= 0, "Negative length in memcopy!"); // Portable naive implementation while (len-- > 0) *dest++ = *src++; } }
public unsafe void AppendString(string stringToAppend) { if (!string.IsNullOrEmpty(stringToAppend)) { if ((this.m_totalSize - this.m_length) < stringToAppend.Length) { throw new IndexOutOfRangeException(); } fixed(char *str = ((char *)stringToAppend)) { char *chPtr = str; Buffer.memcpyimpl((byte *)chPtr, (byte *)(this.m_buffer + this.m_length), stringToAppend.Length * 2); } this.m_length += stringToAppend.Length; } }