c# - How to use String.Format specifier in an expression? -


double paintneeded = area/450; 

when run above, output 0.444444444, wanted 0.44.

i tried this, throws error:

double paintneeded = string.format("{0:0.00}", (area/450));  console.writeline("number of gallons paint needed:\t{0}", paintneeded); 

how use string.format in expression? or can use in console.writeline? if so, how implement it?

console.writeline("number of gallons paint needed:\t{0:f2}", area/450.0); 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -