I really know what Timeout.InfiniteTimespandoes not exist in .NET 4.0.
Noticed there also Timeout.Infinite, which exists in .NET 4.0
I call these two methods:
// the Change-Method
public bool Change(
TimeSpan dueTime,
TimeSpan period
)
// the Constructor of Timer
public Timer(
TimerCallback callback,
Object state,
TimeSpan dueTime,
TimeSpan period
)
in some cases, the parameter dueTimemust be infinite, which means that the event does not fire. I know that I can just use a different overload, but it seems to me that something should be simpler.
I have already tried using new TimeSpan(0, 0, -1)or new TimeSpan(-1)as dueTime. * But this causes a parameter ArgumentOutOfRangeExceptionpointing to the parameter dueTime.
Is it possible to create a literal that works like Timeout.InfiniteTimespanfrom .NET 4.5?
source
share