c# When to pass false to ConfigureAwait function ?

T.Zacks 3,986 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

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,207 questions
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful