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
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
Yes, it is similar to using %d or %l in C. Each enclosing numbered brace indicates it is a placeholder for the next parameter. Here is a good link on the construction of the format: http://msdn.microsoft.com/en-us/library/txafckwd.aspx
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}");
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.