title: Dispatcher.CurrentDispatcher.Invoke
body: <p>Im getting the following error when using the following code:
  Dispatcher.CurrentDispatcher.Invoke(() => actualServer.SetServerData(serverData));
  Cannot convert lambda expression to type 'System.Delegate' because it is not a delegate type</p>
  
  <pre><code>public override void OnApplyTemplate()
      {
          base.OnApplyTemplate();
  
          var source = new List&lt;ServerProperty&gt;
          {
              new ServerProperty("connectionstring1", "server1"),
              new ServerProperty("connectionstring2", "server2"),
              new ServerProperty("connectionstring3", "server3"),
              new ServerProperty("connectionstring4", "server4"),
          };
  
          DataContext = source;
          _timer = new Timer((t) =&gt;
          {
              foreach (var serverProperty in source)
              {
                  ServerProperty server = serverProperty;
                  ThreadPool.QueueUserWorkItem((o) =&gt;
                  {
                      var serverData = ServerDataCalculator.GetServerData(server.ConnectionString);
                      var actualServer = (ServerProperty)o;
                      Dispatcher.CurrentDispatcher.Invoke(() =&gt; actualServer.SetServerData(serverData));
  
                  }, server);
              }
          }, null, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2));
      }
  </code></pre>