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

android - Automated my builds -

c# - Create a custom control in Corel Draw X6 using only VSTA -

ruby on rails - Difference between "Redmine on Heroku" and "Installing Redmine" documentation -