New to C# and I am trying to understand a statement
foreach (int num in numQuery)
{
Console.Write("{0,1} ", num);
}
I am confused about what is that {0, 1} doing there. If it is "{0}", then it is pretty clear, but what does {0, 1} mean?
It looks like it is a custom numeric format string, but matter of fact Charles is right in his comment:
0 is the placeholder 1 is the size of the field so that you can display a columnar result. You can read about this on MSDN by looking at String.Format under the Controlling Spacing section)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With