DisparateBits
DisparateBits
CC#
Created by DisparateBits on 4/9/2024 in #help
Issue with formatted WriteLine
I'm following along with C#12/.net8 and came across this snippet around Ch5. The first one works, the second one cannot parse args, this seems like something simple I'm just not getting. I can print bob.Born or the FavoriteAcientWonder(excuse the typo) but as soon as I add a 3rd arg it won't work.
WriteLine(format: "{0}'s fav wonder is {1}. Integer is {2}",
arg0: bob.Name,
arg1: bob.FavoriteAcientWonder,
arg2: (int)bob.FavoriteAcientWonder);


WriteLine(format: "{0}'s fav wonder is {1}. Integer is {2}. {0} was born on {3}",
arg0: bob.Name,
arg1: bob.FavoriteAcientWonder,
arg2: (int)bob.FavoriteAcientWonder,
arg3: bob.Born);
WriteLine(format: "{0}'s fav wonder is {1}. Integer is {2}",
arg0: bob.Name,
arg1: bob.FavoriteAcientWonder,
arg2: (int)bob.FavoriteAcientWonder);


WriteLine(format: "{0}'s fav wonder is {1}. Integer is {2}. {0} was born on {3}",
arg0: bob.Name,
arg1: bob.FavoriteAcientWonder,
arg2: (int)bob.FavoriteAcientWonder,
arg3: bob.Born);
24 replies