Decimal - Max

Returns the larger of two decimal numbers.

Try it

public static void Main()
{
    Decimal  xDecimal1 = 7m,   xDecimal2 = 57m;
	
	// C# Extension Method: Decimal - Max
	Console.WriteLine("The greater of {0,3} and {1,3} is {2}.", xDecimal1, xDecimal2, xDecimal1.Max(xDecimal2));
}

View Source
using System;

public static partial class Extensions
{
    /// <summary>
    ///     Returns the larger 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 larger.</returns>
    public static Decimal Max(this Decimal val1, Decimal val2)
    {
        return Math.Max(val1, val2);
    }
}