just like in C, format specifiers are used in both printf(), and scanf() functions.
in this C# statement

Console.WriteLine("{0}, {1}", intValue, longValue);

what does it mean by {0},{1}?
are these format specifiers?


regards
san

Recommended Answers

All 3 Replies

it is formatting the output just as you said "formatters".

It put's the values after the string into the numbers in the brackets specified. For example:

Console.WriteLine("{0}, {1}, {3}", dogValue, catValue, birdValue);

Your basically saying this:

Console.WriteLine("{dogValue}, {catValue}, {birdValue}");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.