| ExtensionMethodsRoundToNearest Method (Int32, Int32) |
Rounds a number where you can specify the precision of the rounding
Namespace:
DustProductions.Core
Assembly:
DustProductions.Core (in DustProductions.Core.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static int RoundToNearest(
this int numToRound,
int roundTo
)
Parameters
- numToRound
- Type: SystemInt32
The number being rounded - roundTo
- Type: SystemInt32
The precision of the rounding (e.g. Passing in 5 will round to the nearest number divisible by 5)
Return Value
Type:
Int32An int that has been rounded to the nearest number divisible by roundTo
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
Int32. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also