How to dispose objects having asynchronous methods called?
问题 I have this object PreloadClient which implements IDisposable , I want to dispose it, but after the asynchronous methods finish their call... which is not happening private void Preload(SlideHandler slide) { using(PreloadClient client = new PreloadClient()) { client.PreloadCompleted += client_PreloadCompleted; client.Preload(slide); } // Here client is disposed immediately } private void client_PreloadCompleted(object sender, SlidePreloadCompletedEventArgs e) { // this is method is called