what is {0} this. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is {0} this.

why not {1}

2nd Jul 2016, 12:36 AM
VARUN KUMAR
VARUN KUMAR - avatar
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...
2nd Jul 2016, 6:11 AM
Andreas BeEm Kvist
Andreas BeEm Kvist - avatar
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.
7th Jul 2016, 7:02 AM
Ruth Riparip Secretario
Ruth Riparip Secretario - avatar