Monday, 1 September 2014

Call awaited async() from sync() method

Hi All,

For calling Task awaited async() methods from any normal function we need to make current thread awaited,instead of asynchronously running an independent method.

public void LoadFileAsync()
{

 LoadFileFromStorage().wait();

}

async Task LoadFileFromStorage()
{
//Loading file started...

/*
 Do your stuff
*/

Load file Completed

}



No comments:

Post a Comment