0

Console.WriteLine("Students {0}", variable)
This i understand but what does it mean when you put two numbers within the bracket example:

Console.WriteLine("Students {0,2}: {1,3}", student + 1, grades [student])
What do the 2 and 3 represent. I know the 0 and 1 correspond to variables, but I'm not clear on the second part.

Any help would be appreciated thanks! :)

2
Contributors
1
Reply
19
Views
2 Years
Discussion Span
Last Post by ddanbe
1

You could call the number after the comma a fieldlength specifier.
So {0,2} means: write the first argument 0 and use 2 console positions for it. More explanation can be found here.
Experiment!

Edited by ddanbe: addition

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.