Exemplo n.º 1
0
        public static bool CompareWithInteger8(Integer8 integer8, object secondObject)
        {
            bool isEqual;

            if (integer8 is null && secondObject is null)
            {
                isEqual = true;
            }
Exemplo n.º 2
0
 public Integer32(Integer8 original)
 {
     Value = original.Value;
 }
Exemplo n.º 3
0
        private static bool CompareInteger8(Integer8 integer8Base, object secondObject)
        {
            bool  isEqual;
            sbyte value = integer8Base.Value;

            if (secondObject is Integer8 integer8)
            {
                isEqual = integer8.Value == value;
            }
            else if (secondObject is UInteger8 uInteger8)
            {
                isEqual = uInteger8.Value == value;
            }
            else if (secondObject is Integer16 integer16)
            {
                isEqual = integer16.Value == value;
            }
            else if (secondObject is UInteger16 uInteger16)
            {
                isEqual = uInteger16.Value == value;
            }
            else if (secondObject is Integer32 integer32)
            {
                isEqual = integer32.Value == value;
            }
            else if (secondObject is UInteger32 uInteger32)
            {
                isEqual = uInteger32.Value == value;
            }
            else if (secondObject is Integer64 integer64)
            {
                isEqual = integer64.Value == value;
            }
            else if (secondObject is UInteger64 uInteger64)
            {
                isEqual = uInteger64.Value == (ulong)value;
            }
            else if (secondObject is int integer)
            {
                isEqual = integer == value;
            }
            else if (secondObject is uint uinteger)
            {
                isEqual = uinteger == value;
            }
            else if (secondObject is Int16 integer16Struct)
            {
                isEqual = integer16Struct == value;
            }
            else if (secondObject is UInt16 uinteger16Struct)
            {
                isEqual = uinteger16Struct == value;
            }
            else if (secondObject is Int64 integer64Struct)
            {
                isEqual = integer64Struct == value;
            }
            else if (secondObject is UInt64 uinteger64Struct)
            {
                isEqual = uinteger64Struct == (ulong)value;
            }
            else if (secondObject is float floatingPoint)
            {
                isEqual = System.Math.Abs(floatingPoint - value) < 0.01;
            }
            else if (secondObject is double doubleFloatingPoint)
            {
                isEqual = System.Math.Abs(doubleFloatingPoint - value) < 0.0000001;
            }
            else if (secondObject is decimal decimalFloatingPoint)
            {
                isEqual = decimalFloatingPoint == value;
            }
            else
            {
                isEqual = false;
            }
            return(isEqual);
        }