+ 1

C#: what is {0} or {1}?

17th Feb 2019, 9:32 AM
VITALII !!!
VITALII !!! - avatar
2 odpowiedzi
+ 4
{0} and {1} can be said as "position".
17th Feb 2019, 1:17 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 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".
17th Feb 2019, 10:36 AM
Mitterbu