title: How to wait for async method to finish in C#?
body: <p>For the following code (using EdgeJS module), I want to wait for asynchronous method <code>Start</code> to complete before writing <code>sw.Elapsed</code>, how should I do it?</p>
  
  <pre><code>using System;
  using System.Diagnostics;
  using System.Threading;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using EdgeJs;
  static class Program
  {
      /// &lt;summary&gt;
      /// The main entry point for the application.
      /// &lt;/summary&gt;
      /// 
      [STAThread]
      static  void Main()
      {
          //            Application.EnableVisualStyles();
          //            Application.SetCompatibleTextRenderingDefault(false);
          //            Application.Run(new Form1());
  
          Stopwatch sw =new Stopwatch();
          sw.Start();
          Task.Run((Action)Start).Wait();
          //wait for start to complete --- how should I do it??
          sw.Stop();
          Console.WriteLine(sw.Elapsed);
      }
  
  
      public static async void Start()
      {
          var func = Edge.Func(@"
          var esprima = require('esprima');
          var stringify = require('json-stable-stringify');
  
          var esprimaast = esprima.parse('var a=1;', { loc: true });
          var esprimaStr = stringify(esprimaast, { space: 3 });
          return function (data, callback) {
              callback(null, 'Node.js welcomes ' + esprimaStr);
          }
      ");
  
          Console.WriteLine(await func(".NET"));
          //Console.WriteLine("hello");
      }
  }
  </code></pre>