0

What is the meaning of{0} in this Console.WriteLine??(Thanks for your support)

namespace SoloLearn { class Program { static void Main(string[] args) { for (int x = 10; x < 15; x++) { Console.WriteLine("Value of x: {0}", x); } } } }

24th Feb 2020, 4:47 PM
Erfan Mostafavi
Erfan Mostafavi - avatar
1 Réponse
+ 2
Run the code in play ground and observe output... The value of x is replaced by {0} in output.. It's from same syntax of c printf function.. Ex: ("....{0}{1}{2}...", x, y, z) =>{0} is replaced by x value =>{1}.is replaced by y value =>{2} is replaced by z value...... ... ...
24th Feb 2020, 4:53 PM
Jayakrishna 🇮🇳