Is there a C # equivalent for C ++ streaming manipulators? For instance,
int decimalPlaces = 2; double pi = 3.14159; cout.precision(decimalPlaces); cout << pi;
It seems strange to me to format a number before a string in order to format a number into a string. For instance,
int decimalPlaces = 2; double pi = 3.14159; string format = "N" + decimalPlaces.ToString(); pi.ToString(format);
Is this what was done in C #, or am I missing something?
source share