How do I round down a decimal to 2 decimal places in .Net? -


It should be easy, but I can not get it created in the law for doing this There should be a way of pure structure!

  Private decimal rounddownTo2DecimalPlaces (decimal input) {if (input <0) {new exception ("not tested with negative number"); }     // There must be a better way! Return Mathematics. Cancel (input * 100) / 100; }   

If you are rounding down Required: Math Floor (number * 100) / 100;

If you are looking for something called 'Banker Golling' (probably not, if it's not for numbers / summaries or otherwise):

  Mathematical goals (number, 2);  

In the end, if you want, do not make sure the correct word is 'normal spherical':

  math.Round (number, 2 , Midpoint-rounding. Aveframjiro);  

Comments