【发布时间】:2020-02-15 03:01:53
【问题描述】:
使用Device.StartTimer 与System.Threading.Timer 的优缺点是什么?
两者都在后台线程上触发,都跨平台和 netstandard2 兼容。 System.Threading.Timer 具有非 Xamarin 特定的奖励积分。
我应该使用什么以及何时使用?
- Device.StartTimer 使用原生 API。
- 根据github.com/mono,
System.Threading.Timer似乎为所有定时器使用专用线程。我是对的,还是 Xamarin 使用其他实现?
【问题讨论】:
-
另外,关于如何在
System.Threading.Timer和System.Timers.Timerstackoverflow.com/questions/1416803/… 之间进行选择,有一个很好的、被赞成且非常有用的问题。
标签: c# .net xamarin xamarin.forms timer