public void Append( string value, int start, int count) {
#if BUFFER_BUILDER_TRACING
if ( s_TraceOutput != null ) {
s_TraceOutput.WriteLine( "BufferBuilder.Append\tLength = " + count + "\t string fragment \"" + value.Substring( start, count ) + "\"" );
totalAppendCount++;
}
#endif
if ( value == null ) {
if ( start == 0 && count == 0 ) {
return;
}
throw new ArgumentNullException( "value" );
}
if ( count == 0 ) {
return;
}
if ( start < 0 ) {
throw new ArgumentOutOfRangeException( "start" );
}
if ( count < 0 || start + count > value.Length ) {
throw new ArgumentOutOfRangeException( "count" );
}
if ( length + count <= MaxStringBuilderLength ) {
if ( stringBuilder == null ) {
stringBuilder = new StringBuilder( value, start, count, 0 );
}
else {
stringBuilder.Append( value, start, count );
}
length += count;
}
else {
unsafe {
fixed ( char* source = value ) {
AppendHelper( source + start, count );
}
}
}
}