In that particular example, where you are just tacking one string onto the end of another, it makes no difference.
Using placeholders as in the first example makes a bit more sense when the output needs some more complicated formatting. A simple example would be where you want to insert strings into the middle of the output instead of at the end.
string animal1 = "fox";
string animal2 = "dog";
Console.Write("The quick brown {0} jumps over the lazy {1}.", animal1, animal2);
No comments:
Post a Comment