I have a method called Get and a call back method called X written in C# .I Have to return the _name from the Get method.But it is only possible to get the Actual value of the _name after the callback is finished.So i have to stop at the point of * until call back is finished. After that only i can return the _name .So i have to find whether the call back is finished or not.
How do i achieve a solution for above scenario? Can any one please suggest a solution for this
My methods are something like this
string _name ;
public string Get()
{
//Some Statements
//Asynchronous call to a method and its call back method is X
*Want to stop here until the Call back is finished
return _name ;
}
private void X (IAsyncResult iAsyncResult)
{
//Call Endinvoke and get the result
//assign the final result to global variable _name
}