+ 1
C#: what is {0} or {1}?
2 odpowiedzi
+ 4
{0} and {1} can be said as "position".
+ 1
You will find those when you are going to print a formatted string. The {0} means that the first parameter following your format will be inserted on this position.
Example:
String.Format("Hello {0}. Value: {1}", "World", 4); will print: "Hello World. Value: 4".
If you see '#x27; before the string, this means it is an string interpolation, this might contain interpolated expressions.
Example:
string val="World";
String.Format(quot;Hello {val}"); will print "Hello World".