Disassembling shows that the interval is consumed via a call to (int)Math.Ceiling(this.interval)
so even if you were to specify a real number, it would be turned into an int
before use. This happens in a method called UpdateTimer
.
Why? No idea, perhaps the spec said that double
was required at one point and that changed? The end result is that double
is not strictly required, because it is eventually converted to an int
and cannot be larger than Int32.MaxValue
according to the docs anyway.
Yes, the timer can "support" real numbers, it just doesn't tell you that it silently changed them. You can initialise and run the timer with 100.5d
, it turns it into 101
.
And yes, it is all a bit daft: 4 wasted bytes, potential implicit casting, conversion calls, explicit casting, all needless if they'd just used int
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…