SByte - Sign

Returns a value indicating the sign of an 8-bit signed integer.

Try it

public static void Main()
{
	string str = "{0,6} is {1} zero.";
	
    sbyte[] values = { -127, -67, -8, 0, 56, 112, 127 };

    foreach (Int16 value in values)
    {
		// C# Extension Method: SByte - Sign
        Console.WriteLine(str, value, Display(value.Sign()));
    }
}

public static String Display(int compare)
{
	if (compare == 0) 
    	return "equal to";
	else if (compare < 0)  
    	return "less than";
	else 
    	return "greater than";
}

View Source
using System;

public static partial class Extensions
{
    /// <summary>
    ///     Returns a value indicating the sign of an 8-bit signed integer.
    /// </summary>
    /// <param name="value">A signed number.</param>
    /// <returns>
    ///     A number that indicates the sign of , as shown in the following table.Return value Meaning -1  is less than
    ///     zero. 0  is equal to zero. 1  is greater than zero.
    /// </returns>
    public static Int32 Sign(this SByte value)
    {
        return Math.Sign(value);
    }
}