I understand {0}
is the 1st argument as id
, {1}
is the second argument as sw.Elapsed.TotalMilliseconds
but what is 4
for?
Console.WriteLine("End counting {0} : {1, 4:N0} ms", id, sw.Elapsed.TotalMilliseconds);
Here 4
is alignment specifier. It specifies to align the number 4 units right.
Controlling alignment
By default, strings are right-aligned within their field if you specify a field width. To left-align strings in a field, you preface the field width with a negative sign, such as {0,-12} to define a 12-character right-aligned field.`