I want to wait for a Task
You can use Task.WaitAny
to wait the first of multiple tasks.
You could create two additional tasks (that complete after the specified timeouts) and then use WaitAny
to wait for whichever completes first. If the task that completed first is your "work" task, then you're done. If the task that completed first is a timeout task, then you can react to the timeout (e.g. request cancellation).