c# When to pass false to ConfigureAwait function ?

T.Zacks 3,996 Reputation points
2022-08-29T19:31:13.68+00:00

1) what ConfigureAwait function does ? and when to use it?

async Task<int> GetPageCountAsync()  
{  
    //not shown is how to set up your connection and command  
    //nor disposing resources  
    //nor validating the scalar value  
    var pages = await command.ExecuteScalarAsync().ConfigureAwait(false);  
    return (int)pages;  
}  

Please guide me when i should pass false and when i should not pass false to ConfigureAwait function ?

2) async and await is IO bound job or CPU bound job ? how do i understand it?

Thanks

Developer technologies C#
0 comments No comments
{count} votes

Accepted answer
  1. AgaveJoe 30,126 Reputation points
    2022-08-29T20:00:17.437+00:00
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.