public void Clear() {
if ( length <= MaxStringBuilderLength ) {
if ( stringBuilder != null ) {
stringBuilder.Length = 0;
}
}
else {
if ( lastBuffer != null ) {
ClearBuffers();
}
// destroy the string builder because setting its Length or Capacity to 0 makes it allocate the last string again :-|
stringBuilder = null;
}
length = 0;
}