title: Lifetime of object executing an asynchronous task
body: <p>I have the code below:</p>
  
  <pre><code>void loginButton_Click(object sender, EventArgs e)
  {
      var service = new MyService();
      service.LoginCompleted += (sender2, e2) =&gt;
      {
          //closes the animated loading dialog and show the logged in screen
      };
  
      service.LoginAsync("user", "password");
      //starts an animated "loading" dialog
  }
  </code></pre>
  
  <p>I'm not sure if this is the correct way of doing this as I don't know if GC could remove the <code>MyService</code> instance from memory while the <code>LoginAsync</code> method is waiting for completion and the <code>LoginCompleted</code> event never being called.</p>