Byte - Max

Returns the larger of two 8-bit unsigned integers.

Try it

public static void Main()
{
	string str = "{0}: The greater of {1} and {2} is {3}.";
	
	byte xByte1 = 1, xByte2 = 51;
	
	// C# Extension Method: Byte - Max
	var result = xByte1.Max(xByte2);
	
	Console.WriteLine(str, "Byte", xByte1, xByte2, result);
}

View Source
using System;

public static partial class Extensions
{
    /// <summary>
    ///     Returns the larger of two 8-bit unsigned integers.
    /// </summary>
    /// <param name="val1">The first of two 8-bit unsigned integers to compare.</param>
    /// <param name="val2">The second of two 8-bit unsigned integers to compare.</param>
    /// <returns>Parameter  or , whichever is larger.</returns>
    public static Byte Max(this Byte val1, Byte val2)
    {
        return Math.Max(val1, val2);
    }
}