In .NET many methods that accept a TimeSpan treat TimeSpan.FromMilliseconds(-1)
as an indefinite-wait. This is relatively easy to type and can be defined as such:
static class CaroselsAndSuch {
static readonly TimeSpan IndefiniteWait = TimeSpan.FromMilliseconds(-1);
// etc etc blah bling golden rings
However, this feels like a relatively common situation- Is there a similar 'constant' definition lurking around the core .NET / Task libraries?
Timeout.InfiniteTimeSpan Field
TimeSpan infiniteTimeSpan = Timeout.InfiniteTimeSpan;
A constant used to specify an infinite waiting period, for methods that accept a TimeSpan parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With