Home >Backend Development >C#.Net Tutorial >C# truncation method
Use the Truncate method in C# to remove all digits after the decimal point.
Assume the following are our numbers -
20.35M
To remove the numbers after the decimal point, use Truncate() -
decimal.Truncate(20.35M)
Let’s see the complete code -
using System; using System.Linq; class Demo { static void Main() { decimal dc = 20.35M; Console.WriteLine(dc.Truncate(val)); } }
The above is the detailed content of C# truncation method. For more information, please follow other related articles on the PHP Chinese website!