c# When to pass false to ConfigureAwait function ?

T.Zacks 3,936 Reputation points

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?


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.
7,621 questions
No comments
{count} votes