title: How to convert Task<byte[]> to byte[] to be used inside BackgroundWorker?
body: <p>I have the following method:</p>
  <pre><code> public async Task&lt;byte[]&gt; MyMethod(byte[] my_byte_array)
   {
      //modify my_byte_array ...
  
  
      return  my_modified_byte_array;
       
   }
  </code></pre>
  <p>Now my problem is, I need to call MyMethod inside BackgroundWorker's DoWork as follows:</p>
  <pre><code>private void BackgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
  {
          
      //somewhere in BW
      byte[] my_new_byte_array = MyMethod(my_byte_array);
  
  }
  </code></pre>
  <p>But then I get an error <strong>Cannot implicitly convert type 'System.Threading.Tasks.Task&lt;byte[]&gt;' to 'byte[]'</strong>. When I read about it the solutions directing to change the calling function to asycn. But I am not able to make BackgroundWorker asycn. Is this issue unsolvable? Shifting from BW to other Task methods will cost me huge time.</p>