Decimal.Floor Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Rounds a specified Decimal number to the closest integer toward negative infinity.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
Public Shared Function Floor ( _
d As Decimal _
) As Decimal
public static decimal Floor(
decimal d
)
Parameters
- d
Type: System..::.Decimal
A Decimal.
Return Value
Type: System..::.Decimal
If d has a fractional part, the next whole Decimal number toward negative infinity that is less than d.
-or-
If d doesn't have a fractional part, d is returned unchanged.
Examples
The following code sample illustrates the use of Floor.
Class PiggyBank
Public ReadOnly Property Dollars() As Decimal
Get
Return [Decimal].Floor(MyFortune)
End Get
End Property
Protected MyFortune As Decimal
Public Sub AddPenny()
MyFortune += 0.01D
End Sub
End Class
class PiggyBank
{
public decimal Dollars
{
get
{
return Decimal.Floor(MyFortune);
}
}
protected decimal MyFortune;
public void AddPenny()
{
MyFortune += .01m;
}
}
Version Information
Windows Phone OS
Supported in: 8.1, 8.0, 7.1, 7.0
Platforms
Windows Phone