我可以想到几种方法,例如.
Convert.ToInt32(floatingPoint) - floatingPoint == 0; Math.Truncate(floatingPoint) - floatingPoint == 0; floatingPoint % 1 == 0; Math.Floor(floatingPoint) == floatingPoint; //etc...
但哪种方法最可靠?
c# floating-point isinteger
c# ×1
floating-point ×1
isinteger ×1