title: Asynchronous WCF Services in WPF - events
body: <p>I am using WCF services asynchronously in a WPF application. So I have class with all the web service. The view models call the method in this proc, which in-turn calls the web service.</p>
  
  <p>So the view Model code looks like this: </p>
  
  <pre><code>WebServiceAgent.GetProductByID(SelectedProductID, (s, e)=&gt;{States = e.Result;});
  </code></pre>
  
  <p>And the WebService agent looks like: </p>
  
  <pre><code>    public static void GetProductByID(int ProductID, EventHandler&lt;GetProductListCompletedEventArgs&gt; callback)
      {
          Client.GetProductByIDCompleted += callback;
          Client.GetProductByIDAsync(ProductID);
      }
  </code></pre>
  
  <p>Is this a good approach? I am using MVVM light toolkit. So the View Model static, so in the lifetime of the application, the view model stays. But each time the view model calls this WebServiceAgent, I think I am registering an event. But that event is not being unregistered. </p>
  
  <p>Is this a problem. Lets say the view Model is called for 20 - 30 times. I am inserting some kind of memory leak?</p>