小数点四舍五入
/// <summary> /// 截取小数点位数(四舍五入) /// </summary> /// <param name="v"></param> /// <param name="x"></param> /// <returns></returns> public static decimal subRound(decimal v, int x) { int IValue = 1; for (int i = 1; i <= x; i++) { IValue = IValue * 10; } v = v * IValue; decimal Int = v - (int)v; if (Int >= (decimal)0.5) v += 1; v = (decimal)((int)v) / IValue; return v; }