0

Why do we use 0 in below statement?

Console.WriteLine("Hello {0}")

3rd Dec 2016, 1:29 PM
Niresh Manandhar
Niresh Manandhar - avatar
3 ответов
+ 1
You are missing the 0-index parameter: Console.WriteLine("Hello {0}", "John"); Now the above code will output: Hello John To expand, you could use: Console.WriteLine("Hello {0} {1}", "there", "John"); ... which would output: Hello there John
3rd Dec 2016, 3:51 PM
Green Square Dermatology
Green Square Dermatology - avatar
+ 1
+ Console.WriteLine() calls string.Format() which means you can also use it to format strings example: string hw=string.Format("{0} {1}", "Hello", "World");
19th Dec 2016, 2:14 AM
Dennis Walkewitz
Dennis Walkewitz - avatar
0
thanks buddy 😊
4th Dec 2016, 2:12 AM
Niresh Manandhar
Niresh Manandhar - avatar