とタイマーを実装して、私はそのようなタイマーを実装するために使用:どのようにASP.NETコア前.NETCoreApp1.1
public class Class1
{
Timer tm = null;
public Class1()
{
this.tm.Elapsed += new ElapsedEventHandler(Timer_Elapsed);
this.tm.AutoReset = true;
this.tm = new Timer(60000);
}
protected void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
this.tm.Stop();
try
{
// My business logic here
}
catch (Exception)
{
throw;
}
finally
{
this.tm.Start();
}
}
}
私は.NETCoreApp1.1コンソールアプリケーションとシステムで同じニーズを持っています。タイマーは、ASP.NETコアではもう存在しません。私もSystem.Threading.Timerを使用しようとしましたが、プロジェクトはもう構築されません。
.NETCoreApp1.1でタイマーを実装するにはどうすればよいですか?同等のSystem.Timersはありますか? [OK]を
System.Threading.Timerないサポート.NETのコア> = 1.1.0参照してください。依存関係[セクション](https://www.nuget.org/パッケージ/ System.Threading.Timer /) – Sanket
@Sanket互換性がありますが、FrameworkセクションのMicrosoft.NETCore.Appに依存関係を追加する必要がありました – AdrienTorris