How to run a thread until a condition becomes true in c#

后端 未结 2 694
孤街浪徒
孤街浪徒 2021-01-29 15:27

I am writing a program to send SMS every 5 minutes. I want to stop this when the system time is 6 PM. How can I do that? This is my current code. I want to modify this accordin

2条回答
  •  野性不改
    2021-01-29 16:15

    You can use the below condition to check system TIME.

          `if(DateTime.Now.Hour.ToString("HH") == "18") //Hour is in 24hour format`
    

提交回复
热议问题