Try it! It's not difficult:
void myButton_Click(object sender, EventArgs e)
{
DoAppend();
DoAppendLine();
}
void DoAppend()
{
Stopwatch s = new Stopwatch();
s.Start();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 1000000; i++)
{
sb.Append("hello there");
sb.Append("\n");
}
s.Stop();
Console.WriteLine(s.ElapsedMilliseconds);
}
void DoAppendLine()
{
Stopwatch s = new Stopwatch();
s.Start();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 1000000; i++)
{
sb.AppendLine("hello there");
}
s.Stop();
Console.WriteLine(s.ElapsedMilliseconds);
}
When I did I got these results:
61
82
73
69
76
79
69
76
Which shows that in practice, they are actually pretty much the same. The difference in timings will be due to other things happening in the system, and that the highest can reverse from Append to AppendLine just shows they are pretty identical.