本文整理匯總了VB.NET中System.Decimal.Truncate方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET Decimal.Truncate方法的具體用法?VB.NET Decimal.Truncate怎麽用?VB.NET Decimal.Truncate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Decimal
的用法示例。
在下文中一共展示了Decimal.Truncate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: DecimalFloorNegTruncDemo
' Example of the Decimal.Negate, Decimal.Floor, and Decimal.Truncate
' methods.
Module DecimalFloorNegTruncDemo
Const dataFmt As String = "{0,-30}{1,26}"
' Display Decimal parameters and their product, quotient, and
' remainder.
Sub ShowDecimalFloorNegTrunc( Argument as Decimal )
Console.WriteLine( )
Console.WriteLine( dataFmt, "Decimal Argument", Argument )
Console.WriteLine( dataFmt, _
"Decimal.Negate( Argument )", _
Decimal.Negate( Argument ) )
Console.WriteLine( dataFmt, _
"Decimal.Floor( Argument )", _
Decimal.Floor( Argument ) )
Console.WriteLine( dataFmt, _
"Decimal.Truncate( Argument )", _
Decimal.Truncate( Argument ) )
End Sub
Sub Main( )
Console.WriteLine( "This example of the " & vbCrLf & _
" Decimal.Negate( Decimal ), " & vbCrLf & _
" Decimal.Floor( Decimal ), and " & vbCrLf & _
" Decimal.Truncate( Decimal ) " & vbCrLf & _
"methods generates the following output." )
' Create pairs of Decimal objects.
ShowDecimalFloorNegTrunc( 0D )
ShowDecimalFloorNegTrunc( 123.456D )
ShowDecimalFloorNegTrunc( -123.456D )
ShowDecimalFloorNegTrunc( _
new Decimal( 1230000000, 0, 0, True, 7 ) )
ShowDecimalFloorNegTrunc( -9999999999.9999999999D )
End Sub
End Module
' This example of the
' Decimal.Negate( Decimal ),
' Decimal.Floor( Decimal ), and
' Decimal.Truncate( Decimal )
輸出:
Decimal Argument 0 Decimal.Negate( Argument ) 0 Decimal.Floor( Argument ) 0 Decimal.Truncate( Argument ) 0 Decimal Argument 123.456 Decimal.Negate( Argument ) -123.456 Decimal.Floor( Argument ) 123 Decimal.Truncate( Argument ) 123 Decimal Argument -123.456 Decimal.Negate( Argument ) 123.456 Decimal.Floor( Argument ) -124 Decimal.Truncate( Argument ) -123 Decimal Argument -123.0000000 Decimal.Negate( Argument ) 123.0000000 Decimal.Floor( Argument ) -123 Decimal.Truncate( Argument ) -123 Decimal Argument -9999999999.9999999999 Decimal.Negate( Argument ) 9999999999.9999999999 Decimal.Floor( Argument ) -10000000000 Decimal.Truncate( Argument ) -9999999999