Whenever I have to start a parallel task I usually do this:
public async Task FindPerson(string personId)
{
await Task.Run(() =>
{
//Search the person and write to screen
});
}
However usually I see other coders using AsAsyncOperation:
public IAsyncAction FindPerson(string personId)
{
Task t = new Task(() =>
{
//Search the person and write to screen
});
t.Start();
return t.AsAsyncAction();
}
Does anyone have a clue on what benefits AsAsyncAction brings compared to using the brand new async/await?