获取CancellationToken的剩余时间

时间:2019-04-19 00:54:17

标签: c# async-await task-parallel-library

在C#中,如何获取剩余的时间,之后CancellationToken将被取消?

  async Task<int> Get(CancellationToken ct)
  {
      // How do I get the time after which ct will be cancelled ?
      // DateTime maxTimeToExecuteThisMethod = ?
  }

0 个答案:

没有答案