常用函数总结:
1.string转float:
string temp1 = 6.666;
float temp2 = 0;
temp2 = Convert.Tosingle(temp1);
运行后可得temp2 = 6.666;
2.取小数点后固定位数
float temp = 6.666;
temp = (float)Math.Round(temp,2);
运行后可得temp = 6.66;
常用函数总结:
1.string转float:
string temp1 = 6.666;
float temp2 = 0;
temp2 = Convert.Tosingle(temp1);
运行后可得temp2 = 6.666;
2.取小数点后固定位数
float temp = 6.666;
temp = (float)Math.Round(temp,2);
运行后可得temp = 6.66;