WebClient - wait until file has downloaded
问题 I'm developing a function to return a collection, generated from an xml file. Initially, I was using a local xml file for testing, but now I'm ready to have the app download the real xml file from a server. I'm struggling to see how I could do this due to the fact a WebClient object needs to be given an OpenReadCompleted event handler - I cannot return the collection data from this, and also by the time this handler executes, the original function has ended. My original code is as follows: