不斷的更新日期時間變量我試圖運行在用戶定義的時間了一段代碼,但日期時間變量存儲時間的價值時,我打運行,不更新檢查的時間發生了變化。在C#控制檯應用程序
static void Main(string[] args)
{
Console.WriteLine("please enter the date in m/d/y h/m/s am/pm format ");
DateTime bombDate = Convert.ToDateTime(Console.ReadLine());
repeat:
//DateTime bombDate = "7/27/2016 4:13:16 AM";
DateTime now = DateTime.Now;
if (bombDate == now)
{
string _str = " this is a virus, you have been hit by a logic bomb ...";
while (true)
{
foreach (char c in _str)
{
SendKeys.SendWait(c.ToString());
Thread.Sleep(200);
}
Thread.Sleep(3000);
}
}
else {
goto repeat;
}
你的意思'now'? – user3185569