C#的decimal保留两位小数
方法一:
decimal d = 46.28111;
string dStr = Math.Round( d,2 ).ToString();
结果:dStr = 46.28
方法二:
decimal a = 46.28111;
string result=a.ToString("#0.00");
//结果=46.28
方法三:
decimal d = 46.28111m;
string res=d.ToString("#0.00");
//结果=46.28
方法四:
double d=45.123456;
string res=double.Parse(String.Format("{0:N}", d)).ToString();
//结果=45.12