Answers for "How to truncate a decimal without rounding"

C#
0

How to truncate a decimal without rounding

var value = 1.23456M;
var shortenedValue = Convert.ToDecimal(value.ToString("0.###"));

Assert.Equals(shortenedValue, 1.234);
1234
Posted by: Guest on October-07-2021

Code answers related to "How to truncate a decimal without rounding"

C# Answers by Framework

Browse Popular Code Answers by Language