Rounds a decimal value towards zero, to the closest integer value.
- d
- The decimal to truncate.
The decimal result of truncating d . the scale of the result is 0.
Documentation for this section has not yet been entered.
The following example demonstrates using the decimal.Truncate(decimal) method.
C# Example
using System; class MyClass { public static void Main() { decimal d1 = 1234.56789m; decimal d2 = -1234.56789m; Console.WriteLine("{0} truncated is {1}", d1, Decimal.Truncate(d1)); Console.WriteLine("{0} truncated is {1}", d2, Decimal.Truncate(d2)); } }The output is
1234.56789 truncated is 1234
-1234.56789 truncated is -1234
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0