Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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

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

PREVIOUS NEXT
Code Example
Csharp :: use different database with entitymanagerfactory 
Csharp :: C# webclient immitate browser 
Csharp :: weakreference tryget c# 
Csharp :: nethereum check gas price 
Csharp :: c# pass mouse events to parent 
Csharp :: laravel get current url 
Html :: google material icons cdn 
Html :: html input integer and positive 
Html :: ion-item remove bottom line 
Html :: html starter code 
Html :: html hello world 
Html :: align center inner div using bootstrap 
Html :: html chevron 
Html :: html entity double quote 
Html :: html tab 
Html :: how to change website icon html 
Html :: a href mail 
Html :: difference between name and value in html 
Html :: input suggestion off 
Html :: html textarea height 
Html :: back button ionic 
Html :: mobile prevent zoom 
Html :: tailwind css textarea 
Html :: Change the required text 
Html :: html importer une image 
Html :: how to change the size of an image in html 
Html :: input required 
Html :: html input color picker 
Html :: how to put an image in the top right corner html 
Html :: how to right align a text button 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =