1.异步方法的定义
public string GetValue() { return "value"; } public async Task<string> GetValueAsync() { string t = await Task.Run(() => GetValue()); return t; }
2.异步方法的调用
Task<string> t = GetValueAsync(); string value = await t;
原文:https://www.cnblogs.com/by-lhc/p/9669699.html