"Chris Shepherd" <ch**@nospam.chsh.cawrote in message
news:ug**************@TK2MSFTNGP04.phx.gbl...
I am with Peter on this, just because it wasn't done doesn't mean they
forgot.
The possibility which makes the most sense to me relates to code clarity.
Making you use a property of the TimeSpan makes it perfectly clear what
property you are doing the math on, and what your expected result would
be.
I'm not saying it's a perfect reason to not do it, I'm just guessing and
don't know any more than the people who have already spoken up.
To me it made such perfect sense that I went and coded it fully expecting it
to work. I was quite suprised some time later to get a compile error. The
alternative:
TimeSpan ts2 = new TimeSpan(ts1.Ticks / 2)
appears much more complicated and although I presume that is the correct way
to do it I'm still not certain. Should I convert it to Milliseconds and back
or maybe seconds? Should I be using a double variable or an integer or long?
The only thing I can think of is that doing "ts1 / 2" it's not clear how it
will round but I don't think that's much of an issue. Obviously programmers
will expect it to have a certain level of resolution and that dividing by 2
could cause some minor loss of information.
Michael