Microsoft.Cci.ExpressionHelper.IsNumericZero C# (CSharp) Метод

IsNumericZero() приватный Метод

private IsNumericZero ( ICompileTimeConstant constExpression ) : bool
constExpression ICompileTimeConstant
Результат bool
    public static bool IsNumericZero(ICompileTimeConstant constExpression) {
      IConvertible/*?*/ ic = constExpression.Value as IConvertible;
      if (ic == null) return false;
      switch (ic.GetTypeCode()) {
        case System.TypeCode.SByte: return ic.ToSByte(null) == 0;
        case System.TypeCode.Int16: return ic.ToInt16(null) == 0;
        case System.TypeCode.Int32: return ic.ToInt32(null) == 0;
        case System.TypeCode.Int64: return ic.ToInt64(null) == 0;
        case System.TypeCode.Byte: return ic.ToByte(null) == 0;
        case System.TypeCode.UInt16: return ic.ToUInt16(null) == 0;
        case System.TypeCode.UInt32: return ic.ToUInt32(null) == 0;
        case System.TypeCode.UInt64: return ic.ToUInt64(null) == 0;
        case System.TypeCode.Single: return ic.ToSingle(null) == 0;
        case System.TypeCode.Double: return ic.ToDouble(null) == 0;
        case System.TypeCode.Decimal: return ic.ToDecimal(null) == 0;
      }
      return false;
    }