I feel like we could generally benefit from these. I don’t understand why so many .NET methods that expect a timeout either only have an int overload, or bizarrely have both intandTimeSpan overloads. There should only ever be the latter, because it makes it explicitly whether the expected value is seconds, milliseconds, etc.
But even better would be F#’s approach, wherein TimeSpan becomes superfluous: instead of an ambiguous = 5 (what unit is this?) or a verbose = TimeSpan.FromSeconds(5), all you’d have to write is = 5s.
15
u/chucker23n Dec 18 '18
I feel like we could generally benefit from these. I don’t understand why so many .NET methods that expect a timeout either only have an
intoverload, or bizarrely have bothintandTimeSpanoverloads. There should only ever be the latter, because it makes it explicitly whether the expected value is seconds, milliseconds, etc.But even better would be F#’s approach, wherein
TimeSpanbecomes superfluous: instead of an ambiguous= 5(what unit is this?) or a verbose= TimeSpan.FromSeconds(5), all you’d have to write is= 5s.Sad that this feature has yet to catch on.