For reference...
The StringBuilder's initial capacity is set to 16 by default. The capacity then increases by an order of 2 whenever the current capacity is passed. Therefore, if the String you append to the StringBuilder causes the capacity to expand, it will increase as
seen below:
StringBuilder sb =
new System.Text.StringBuilder();
int capacity = sb.Capacity;
for (int i=0; i<5000; i++)
{
sb.Append("a");
if (capacity != sb.Capacity)
{
PrintLine("Capacity: " + sb.Capacity);
}
capacity = sb.Capacity;
}
results in the following capacity adjustments:
Capacity: 16
Capacity: 32
Capacity: 64
Capacity: 128
Capacity: 256
Capacity: 512
Capacity: 1024
Capacity: 2048
Capacity: 4096
Capacity: 8192