public void Callbacs(IAsyncResult result) { var resd = mydele.EndInvoke(result); var ss = Thread.CurrentThread.ManagedThreadId; Action <string> act = (str) => { this.textBox1.Text = str; }; this.textBox1.Invoke(act, resd); }
public static void CallbackFun(IAsyncResult result) { var sssd = result.AsyncState as string; Console.WriteLine(sssd); while (true) { if (!result.IsCompleted) { Console.WriteLine($"等待异步结束,当前线程{Thread.CurrentThread.ManagedThreadId.ToString()}"); } else { break; } } var re = dele.EndInvoke(result); Console.WriteLine($"异步结束,当前线程{Thread.CurrentThread.ManagedThreadId.ToString()}"); // Thread.Sleep(2000); Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); }