Use the Truncate method in C# to remove all the numbers after decimal places.
Let’s say the following is our number −
20.35M
To remove the numbers after decimal places, use Truncate() −
decimal.Truncate(20.35M)
Let us see the comple code −
Example
using System;
using System.Linq;
class Demo {
static void Main() {
decimal dc = 20.35M;
Console.WriteLine(dc.Truncate(val));
}
}