title: How to get bool result from async task<bool> function in C# - Error: Cannot implicitly convert type `void' to `bool'
body: <p>I have created task function for validating my json file. Everything works fine until I didn't use the result. When I am trying to get the result from <code>async task&lt;bool&gt; function</code> it is showing error as <code>Cannot implicitly convert 'void' to bool</code>. My async function is as follows:</p>
  
  <pre><code> private async Task&lt;bool&gt; MyValidationFunction(string json)
   {
       bool isValid = true;
       .......DOING MY VALIDATION STUFF.....
       return isValid;
   }
  </code></pre>
  
  <p>Calling this function from another function is as follows:</p>
  
  <pre><code> public bool GetJsonAndValidate()
   {
        bool isValid = true;
        string jsonData = GetJson();
        //******* Here I am getting the error.
        bool isValid = MyValidationFunction(jsonData).Wait(); 
   }
  </code></pre>
  
  <p>When I am trying to call <code>MyValidationFunction</code> it is showing error as mention above. I have tried to get result by using <code>Result</code> property but it is throwing and error. My Class is just simple public class. I can do it with synchronous call but I need to have asynchronous call as <code>MyValidationFunction</code> get the result from database. If I didn't use the bool variable to capture the result, then it works fine. What I have missed out? How can I get bool result from my validation function?</p>