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
}
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