Truncates the specified TdDecimal structure to a specified decimal position.
The following is an example of truncating a number:
TdDecimal value = TdDecimal.Parse("10242954.9352");
// Truncating at position 2 results in 10242954.93
TdDecimal result = TdDecimal.Truncate(value, 2);
// Truncating at position 0 reslts in 10242954
result = TdDecimal.Truncate(value, 0);
try
{
// An ArgumentOutOfRangeException will be thrown if a negative value for position is specified.
result = TdDecimal.Truncate(value, -1);
}
catch (ArgumentOutOfRangeException)
{
Console.WriteLine("A negative number cannot be specified for the position");
}
Target Platforms: Windows 7, Windows 8, Windows 8.1, Windows 10, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2