I have this function with action parameter, after it was executed the parameter on that function will have a value. Is there a way for me to get the value?
public void DetailsAsync(string param1, string param2,Action<IList<Detail>> callback)
{
//process happen here and will have a callback to produce the data for detail
}
public class DetailController:ApiController
{
private IList<Detail> details;
private DetailCompleted(IList<Detail> detail)
{
//now detail parameter has a value that I can use
details = detail;
}
[HttpGet]
public IList<Detail> GetDetails()
{
ServiceManager.DetailsAsync("param1","param2",detailsCompleted)
//after ServiceManager.DetailsAsync it will go to return details
return details;
}
}
When I tried this code, I placed a breakpoint on return details and breakpoint on detailsCompleted but what happen is that when I called the web api GetDatails, it will first execute return details and right after that it will execute detailsCompleted function. that's why currently I cant get the value.