Math.Round(12.13,0)
-整数部分就是小数.

解决方案 »

  1.   

    float f1 ,result;
    得到小数点前一位:
    string sum;
    float[] f2;
    f1= 2012.111;
    f2 = f1.Split('.');
    sum= right(f2[0].tostring(),1);
    sum = sum + "." + f2[1].tostring();
    result = float.parse(sum);最后result就等于2.111
    同理你也可以得到小树点后一位
      

  2.   

    using System;
    using System.IO;public class Testfloat
    {
    public Testfloat()
    {
    //File.Create("dd.dbf");
    float f1 = 2012.12f;
    string str =  f1.ToString().Substring(f1.ToString().IndexOf('.') - 1);
    Console.WriteLine(str);
    Console.WriteLine(Single.Parse(str));
    }

    public static void Main()
    {
    new Testfloat();
    }

    }
      

  3.   

    应该用Math.Floor()取整
    Math.Round()是四舍五入取整