This question already has an answer here:
这个问题在这里已有答案:
- Round up to next quarter 3 answers
四舍五入到下一季度3个答案
How can I round decimal up (not down) to 0.25?
如何将十进制数(不是向下)舍入到0.25?
1.26 -> 1.50
1.45 -> 1.50
1.15 -> 1.25
1.00 -> 1.00
1.55 -> 1.75
1.77 -> 2.00
I have tried following function but no success.
我试过以下功能,但没有成功。
Decimal.Round(x * 4, MidpointRounding.ToEven) / 4