Single - Max

Returns the larger of two single-precision floating-point numbers.

Try it

public static void Main()
{
    float  x = 7.5f,   y = 57.2f;
	
	// C# Extension Method: Single - Max
	Console.WriteLine("The maximum of {0} and {1} is {2}.", x, y, x.Max(y));
}

View Source
using System;

public static partial class Extensions
{
    /// <summary>
    ///     Returns the larger of two single-precision floating-point numbers.
    /// </summary>
    /// <param name="val1">The first of two single-precision floating-point numbers to compare.</param>
    /// <param name="val2">The second of two single-precision floating-point numbers to compare.</param>
    /// <returns>Parameter  or , whichever is larger. If , or , or both  and  are equal to ,  is returned.</returns>
    public static Single Max(this Single val1, Single val2)
    {
        return Math.Max(val1, val2);
    }
}