I have a deserialization method (XML) that functions well until it gets to X number of objects. Below X, the time is takes to deserialize is acceptable and the UI being blocked is not a problem. However, if the number of objects is greater than X (relatively unlikely, but possible), then the load time is too long. Is it possible to jump from the UI thread to a background thread once deserialization (or any other method) has started so that I can unlock the UI thread if the deserialization is taking too long? thanks
I have a deserialization method (XML) that functions well until it gets to X
Share
Just do the deserialization in a background thread in all cases. It won’t be an issue if the number of objects is below X, and it won’t block the UI if it is greater than X.
You can do it in a background worker, and use the result in the
RunWorkerCompletedevent (which is raised on the UI thread)