Horje
getawaiter and no extension method Code Example
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;
}
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;
}




Csharp

Related
_swapbatch.foreach multiple statements c# Code Example _swapbatch.foreach multiple statements c# Code Example
how crate cron netapp Code Example how crate cron netapp Code Example
flsa itextsharp Code Example flsa itextsharp Code Example
how to show error xtramessagebox in devexpress c# Code Example how to show error xtramessagebox in devexpress c# Code Example
c# reduce a collection to a string Code Example c# reduce a collection to a string Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9