DateTime dt=new DateTime(DateTime.Now.Year,DateTime.Now.Month,DateTime.Now.Day,DateTime.Now.Hour+1,DateTime.Now.Minute,DateTime.Now.Second);//设置为一小时到时
while(true)
{
if((DateTime.Now.Hour==dt.Hour) && (DateTime.Now.Minute==dt.Minute) && (DateTime.Now.Second==dt.Second))
{
Console.WriteLine("时间到!");
break;
}
}
Console.ReadLine();