Both of these generate an error saying they must be a compile-time constant:
void Foo(TimeSpan span = TimeSpan.FromSeconds(2.0)) void Foo(TimeSpan span = new
My suggestion:
void A( long spanInMs = 2000 ) { var ts = TimeSpan.FromMilliseconds(spanInMs); //... }
BTW TimeSpan.FromSeconds(2.0) does not equal new TimeSpan(2000) - the constructor takes ticks.
TimeSpan.FromSeconds(2.0)
new TimeSpan(2000)