Decimal.Floor Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Rounds a specified Decimal number to the closest integer toward negative infinity.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)


<SecuritySafeCriticalAttribute> _
Public Shared Function Floor ( _
    d As Decimal _
) As Decimal
public static decimal Floor(
    decimal d


Return Value

Type: System.Decimal
If d has a fractional part, the next whole Decimal number toward negative infinity that is less than d.
If d doesn't have a fractional part, d is returned unchanged.


The following code sample illustrates the use of Floor.

Class PiggyBank
   Public ReadOnly Property Dollars() As Decimal
         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
         return Decimal.Floor(MyFortune);

   protected decimal MyFortune;

   public void AddPenny()
      MyFortune += .01m;

Version Information


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.