How do I call a method that returns a bool, but inside that method in order to determine the value of the bool, it calls a web service asyncronously?
bool myBool = GetABoolean(5);
public bool GetABoolean(int id)
{
bool aBool;
client.CallAnAsyncMethod(id); // value is returned in a completed event handler. Need to somehow get that value into aBool.
return aBool; // this needs to NOT execute until aBool has a value
}
So what I need is for the GetABoolean method to wait until CallAnAsyncMethod has completed and returned a value before returning the bool back to the calling method.
I'm not sure how to do this.