Decimal - Ceiling
Returns the smallest integral value that is greater than or equal to the specified decimal number.
public static void Main() { decimal[] values = { 7.03m, 7.64m, 0.12m, -0.12m, -7.1m, -7.6m }; Console.WriteLine(" Value Ceiling\n"); foreach (decimal value in values) { // C# Extension Method: Decimal - Ceiling Console.WriteLine("{0,7} {1,16}", value, value.Ceiling()); } }
View Source
using System; public static partial class Extensions { /// <summary> /// Returns the smallest integral value that is greater than or equal to the specified decimal number. /// </summary> /// <param name="d">A decimal number.</param> /// <returns> /// The smallest integral value that is greater than or equal to . Note that this method returns a instead of an /// integral type. /// </returns> public static Decimal Ceiling(this Decimal d) { return Math.Ceiling(d); } }