Possible Duplicate:
c# - How do I round a decimal value to 2 decimal places (for output on a page)
I want to truncate the decimals like below
i.e.
double d = 2.22977777;
d = ( (double) ( (int) (d * 1000.0) ) ) / 1000.0 ;
Of course, this won't work if you're trying to truncate rounding error, but it should work fine with the values you give in your examples. See the first two answers to this question for details on why it won't work sometimes.