示例#1
0
 public Integer32(UInteger16 original)
 {
     Value = original.Value;
 }
示例#2
0
        private static bool CompareUInteger16(UInteger16 uInteger16Base, object secondObject)
        {
            bool   isEqual;
            ushort value = uInteger16Base.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 == 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 == 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);
        }