VB.Net by API/System/Decimal — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 16:40, 26 мая 2010
Содержание
Decimal.Compare
public class Test
public Shared Sub Main
Dim D1, D2 As Decimal
D1 = 10
D2 = 5.7
Console.WriteLine(Decimal.rupare(D1, D2))
End Sub
End class
Decimal.Divide
public class Test
public Shared Sub Main
Dim D1, D2 As Decimal
D1 = 10
D2 = 5.7
Console.WriteLine(Decimal.Divide(D1, D2))
End Sub
End class
Decimal.Floor
public class Test
public Shared Sub Main
Console.WriteLine(Decimal.Floor(5.7))
End Sub
End class
Decimal.GetBits
public class Test
public Shared Sub Main
Dim D1, D2 As Decimal
D1 = 10
D2 = 5.7
Console.WriteLine(Decimal.GetBits(3).GetValue(0))
End Sub
End class
Decimal.MaxValue
Public Class Tester
Public Shared Sub Main
Dim result As New System.Text.StringBuilder
Dim maxDecimal As Decimal = Decimal.MaxValue
Dim sizeOfDecimal As Integer = Runtime.InteropServices.Marshal.SizeOf(maxDecimal.GetType)
result.Append("Memory size of a Decimal (bytes): ")
result.AppendLine(sizeOfDecimal)
result.Append("Maximum value of a Decimal: ")
result.AppendLine(maxDecimal)
result.Append("Divided by one million: ")
result.AppendLine(maxDecimal / 1000000D)
result.Append("1D / 3D: ")
result.AppendLine(1D / 3D)
Console.WriteLine(result.ToString())
End Sub
End Class
Decimal.MinValue
public class Test
public Shared Sub Main
Dim dNum As Decimal
Console.WriteLine("Decimal: " & dNum.MinValue & " to " & dNum.MaxValue)
End Sub
End class