public class MyClass
{
MyEntities db = new MyEntities();
public MyClass()
{
this.Initialise(); // Does not return immediately. Why?
}
private async void Initialise();
{
await this.db.Entities.LoadAsync();
}
}
如果我将 Initialise 更改为使用 await Task.Run() 来调用同步 this.db.Entities.Load() 那么它会按预期立即返回。