public void Append( char[] value, int start, int count ) {
#if BUFFER_BUILDER_TRACING
if ( s_TraceOutput != null ) {
s_TraceOutput.WriteLine( "BufferBuilder.Append\tLength = " + count + "\t char array \"" + new string( value, 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( count < DefaultSBCapacity ? DefaultSBCapacity : count );
}
stringBuilder.Append( value, start, count );
length += count;
}
else {
unsafe {
fixed( char* source = &value[start] ) {
AppendHelper( source, count);
}
}
}
}