+ 1
what is {0} this.
why not {1}
2 Answers
+ 2
Both works.
Console.Write("I am {0}, and my age is {1}, {2}", name, age, greeting);
// The {x} is a place holder for a variable. It's just another way instead of using "I am + name + ", and my...
0
It's a place holder in the string. For example:
string b = "world."; Console.WriteLine("Hello {0}", b);
Would produce this output:
Hello world.