I have an async
function. There are multiple levels of function calls that all return a Task
. At some point in this chain I must modify the value of the result. I would like to do this without interrupting the flow of the async
functions. Observe:
[HttpGet]
[Route("GetWeb")]
public async Task<IHttpActionResult> GetResult([FromUri] string url)
{
var result = await GetPageText(url);
return Ok(result);
}
private Task<string> GetPageText(string url)
{
Task<string> data = GetDataAsync(url);
//here I would like to manipulate the data variable
return data;
}
In the function GetPageText
how do I manipulate the data variable without interrupting the asynchronous flow. Is this possible?