.net扩展方法——对小数进行取位,默认保留2个小数点
#region 对小数进行取位 /// <summary> /// 对小数进行取位,默认保留2个小数点 /// </summary> /// <param name="dcmal"></param> /// <param name="point"></param> /// <returns></returns> public static decimal Round(this decimal dcmal, int point = 2) { return Math.Round(dcmal, point); } /// <summary> /// 对小数进行取位,默认保留2个小数点 /// </summary> /// <param name="dcmal"></param> /// <param name="point"></param> /// <returns></returns> public static decimal Round(this decimal? dcmal, int point = 2) { return Math.Round(dcmal ?? 0, point); } /// <summary> /// 对小数进行取位,默认保留2个小数点 /// </summary> /// <param name="dcmal"></param> /// <param name="point"></param> /// <returns></returns> public static double Round(this double dcmal, int point = 2) { return Math.Round(dcmal, point); } #endregion 对小数进行取位