本文整理汇总了VB.NET中System.Decimal.Negate方法的典型用法代码示例。如果您正苦于以下问题:VB.NET Decimal.Negate方法的具体用法?VB.NET Decimal.Negate怎么用?VB.NET Decimal.Negate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Decimal
的用法示例。
在下文中一共展示了Decimal.Negate方法的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