0
Why we are using {0}???
3 Answers
+ 7
{0} is refer to first index number
{1} is refer to second index number and so on.
example:
int x = 5;
double y = 6.8;
int z = 7;
Console.WriteLine("numbers are {0} and {2}", x,y,z) ;
/*the output is :
numbers are 5 and 7*/
+ 4
This is for printing a formatted string.
For exmple:
String.Format(âThis {0} an example.â, âisâ);
//output
This is an example.
You can store variables in there too like:
string text = âisâ;
Console.WriteLine(âThis {0} an example.â, text);
+ 1
Got it
thanks a lot :)