I know how to make Async methods but say I have a method that does a lot of work then returns a boolean value?
How do I return the boolean value on the callback?
Clarification:
public bool Foo(){
Thread.Sleep(100000); // Do work
return true;
}
I want to be able to make this asynchronous.
There are a few ways of doing that… the simplest is to have the async method also do the follow-on operation. Another popular approach is to pass in a callback, i.e.
Another approach would be to raise an event (with the result in the event-args data) when the async operation is complete.
Also, if you are using the TPL, you can use
ContinueWith: