rounded to the nearest 10's place in c#
问题 I want to The numbers are being rounded to the nearest 10 's place. For example, a number like 17.3 is being rounded to 20.0 . and want to be allow three significant digits. Meaning for round to the nearest tenth of a percent as the last step of the process. Sample : the number is 17.3 ,i want round to 20 , and this number is 13.3 , i want round to 10 ? How can i do this ? 回答1: Chris Charabaruk gives you your desired answer here To get to the core, here is his solution as an extension method: