在C#中使用Truncate方法删除小数点后的所有数字。
假设以下是我们的号码-
20.35M
要删除小数点后的数字,请使用Truncate()-
decimal.Truncate(20.35M)
让我们看看编译代码-
using System;
using System.Linq;
class Demo {
static void Main() {
decimal dc = 20.35M;
Console.WriteLine(dc.Truncate(val));
}
}