Reputation: 182
this code will not print the value year and I cant figure out why.
String words = string.Format("{0,-60}" + "|" + "{0,-7}" + "|" + "{0,-20}" +
"|" + "{0,-20}", Title, Year, Album, Artist);
Everything else works and if I print each value without formatting like this it works fine
String words = string.Format(Title + ", " + Year + ", " + album + ", " +
Author); //works
Upvotes: 0
Views: 351
Reputation: 396
The way you have it you have only referenced the Title parameter in the format string. Try String words = string.Format("{0,-60}" + "|" + "{1,-7}" + "|" + "{2,-20}" +
"|" + "{3,-20}", Title, Year, Album, Artist);
More information on the behavior of String.Format can be found here: https://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx
Upvotes: 2