Async、Await、Task 12345678910111213141516171819202122232425static void Main(string[] args){ TestService sv = new TestService(); sv.Function(); Console.WriteLine("done"); Console.Read();}public class TestService{ public TestService() { } public async Task Function() { Stopwatch st = new Stopwatch(); st.Start(); await Task.Delay(10000); st.Stop(); Console.WriteLine(st.ElapsedMilliseconds/1000); }} Task更新資料 1234private async void CommonFlowClickCommandAction(object obj){ await Task.Run(() => CommonFlow());} ← Previous Post Next Post → FEATURED TAGS C# async await FRIENDS It Helps SEO