Код: Выделить всё
public async Task DoSomethingComplexAsync()
{
...
using (var x = new MyObject)
{
//don't do this inside the using! It causes the calling method to return, and x to be disposed
await DoAnotherThingAsync();
//throws an ObjectDisposedException
x.DoAThirdThing();
}
...
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... sing-block
Мобильная версия