Answers for "getawaiter and no extension method"

C#
0

getawaiter and no extension method

//How to Apply async & await in C#
private async Task<List<MyObject>> GetBigListAsync()
{
    var myTask = Task.Run( () => GetBigList());
    // your thread is free to do other useful stuff right nw
    DoOtherUsefulStuff();
    // after a while you need the result, await for myTask:
    List<MyObject> result = await myTask;

    // you can now use the results of loading:
    ProcessResult(result);
    return result;
}
Posted by: Guest on March-02-2021
0

getawaiter and no extension method

private async Task<List<MyObject>> GetBigListAsync()
{
    var myTask = Task.Run( () => GetBigList());
    // your thread is free to do other useful stuff right nw
    DoOtherUsefulStuff();
    // after a while you need the result, await for myTask:
    List<MyObject> result = await myTask;

    // you can now use the results of loading:
    ProcessResult(result);
    return result;
}
Posted by: Guest on March-02-2021

Code answers related to "getawaiter and no extension method"

C# Answers by Framework

Browse Popular Code Answers by Language