标签:int 方法 edit exec 执行 begin ++ for string
Thread thread = new Thread(()=> { for (int i = 0; i < 20; i++) { Console.WriteLine("这是第" + i + "个"); Thread.Sleep(500); } }); thread.IsBackground = true;//设置为后台线程 thread.Start();//启动程序
//【1】定义一个委托 public delegate int MyCalculator(int num); //定义方法 private int ExecuteTask1(int num) { System.Threading.Thread.Sleep(5000); return num * num; } //执行方法 MyCalculator myCalculator = ExecuteTask1;//创建委托变量并指向方法1 //异步调用任务 IAsyncResult result = myCalculator.BeginInvoke(20,null,null); this.lbl1.Text = "正在计算请稍等..."; //同时执行其他任务 this.lbl2.Text = ExecuteTask2(20).ToString(); //获取异步执行的结果 int res = myCalculator.EndInvoke(result); lbl1.Text = res.ToString(); myCalculator(20);
public async Task<IActionResult> Edit(string id) { if (id == null) { return NotFound(); } var order = await _context.Order.SingleOrDefaultAsync(m => m.OrderId == id); if (order == null) { return NotFound(); } return View(order); } public async Task<IActionResult> DeleteConfirmed(string id) { var order = await _context.Order.SingleOrDefaultAsync(m => m.OrderId == id); _context.Order.Remove(order); await _context.SaveChangesAsync(); return RedirectToAction(nameof(Index)); }
标签:int 方法 edit exec 执行 begin ++ for string
原文地址:https://www.cnblogs.com/mybk/p/9001898.html