Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting a string #20

Closed
dpkwhan opened this issue Jan 2, 2022 · 1 comment
Closed

Formatting a string #20

dpkwhan opened this issue Jan 2, 2022 · 1 comment

Comments

@dpkwhan
Copy link

dpkwhan commented Jan 2, 2022

On page 83 of the print book, the formatting string is not necessary when outputting the header since arg1 is a string:

Console.WriteLine(
    format: "{0,-10} {1,6}",
    arg0: "Name",
    arg1: "Count"
);
@markjprice
Copy link
Owner

Thank you for spotting this issue. You are correct that the format string does not need the number format code i.e. ":N0". But it does still need the format string to make the column heading right-aligned. I have fixed this issue in the code solutions and added an errata: https://github.com/markjprice/cs10dotnet6/blob/main/errata.md#page-83---understanding-format-strings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants