AT.MIN.Tools.IsPositive C# (CSharp) Method

IsPositive() public static method

Determines whether the specified value is positive.
public static IsPositive ( object Value, bool ZeroIsPositive ) : bool
Value object The value.
ZeroIsPositive bool if set to true treats 0 as positive.
return bool
		public static bool IsPositive( object Value, bool ZeroIsPositive )
		{
			switch ( Type.GetTypeCode( Value.GetType() ) )
			{
				case TypeCode.SByte:
					return ( ZeroIsPositive ? (sbyte)Value >= 0 : (sbyte)Value > 0 );
				case TypeCode.Int16:
					return ( ZeroIsPositive ? (short)Value >= 0 : (short)Value > 0 );
				case TypeCode.Int32:
					return ( ZeroIsPositive ? (int)Value >= 0 : (int)Value > 0 );
				case TypeCode.Int64:
					return ( ZeroIsPositive ? (long)Value >= 0 : (long)Value > 0 );
				case TypeCode.Single:
					return ( ZeroIsPositive ? (float)Value >= 0 : (float)Value > 0 );
				case TypeCode.Double:
					return ( ZeroIsPositive ? (double)Value >= 0 : (double)Value > 0 );
				case TypeCode.Decimal:
					return ( ZeroIsPositive ? (decimal)Value >= 0 : (decimal)Value > 0 );
				case TypeCode.Byte:
					return ( ZeroIsPositive ? true : (byte)Value > 0 );
				case TypeCode.UInt16:
					return ( ZeroIsPositive ? true : (ushort)Value > 0 );
				case TypeCode.UInt32:
					return ( ZeroIsPositive ? true : (uint)Value > 0 );
				case TypeCode.UInt64:
					return ( ZeroIsPositive ? true : (ulong)Value > 0 );
				case TypeCode.Char:
					return ( ZeroIsPositive ? true : (char)Value != '\0' );
				default:
					return false;
			}
		}
		#endregion