Decimal - Min
Returns the smaller of two decimal numbers.
public static void Main() { Decimal xDecimal1 = 7m, xDecimal2 = 57m; // C# Extension Method: Decimal - Min Console.WriteLine("The minimum of {0,3} and {1,3} is {2}.", xDecimal1, xDecimal2, xDecimal1.Min(xDecimal2)); }
View Source
using System; public static partial class Extensions { /// <summary> /// Returns the smaller of two decimal numbers. /// </summary> /// <param name="val1">The first of two decimal numbers to compare.</param> /// <param name="val2">The second of two decimal numbers to compare.</param> /// <returns>Parameter or , whichever is smaller.</returns> public static Decimal Min(this Decimal val1, Decimal val2) { return Math.Min(val1, val2); } }