日期:2014-05-18  浏览次数:20423 次

在以下方法或属性之间的调用不明确:“System.Math.Floor(decimal)”和“System.Math.Floor(double)
这个是我正在调试的程序中的一段,现在出现问题了:


C# code
    //时间转化
                Int64 timeInMillis=Convert.ToInt64(e.Item.Cells[2].Text.Trim());

                int hours = (int)Math.Floor(timeInMillis/(60*60));
                int minutes = (int)Math.Floor((timeInMillis %(60*60))/60);
                int seconds = (int)(timeInMillis %(60*60))%60;
                e.Item.Cells[2].Text=hours.ToString()+"H"+minutes.ToString()+"M"+seconds.ToString()+"S";


然后就提示 在以下方法或属性之间的调用不明确:“System.Math.Floor(decimal)”和“System.Math.Floor(double)

------解决方案--------------------
不能区分你参数是哪一种数据类型,强制说明一下,比如

int hours = (int)Math.Floor((double)timeInMillis/(60*60));

------解决方案--------------------
数据类型转化问题