title: C# - Using a function with "out" parameter within a Thread
body: <p>I have the following function and I'd like to use it within a <code>System.Threading.Thread</code> :</p>
  
  <pre><code>private void tempFunction(int num, out string fullname, out string info)
  {
      // Doing a very long scenario.
      // When finished, send results out!
      fullname = result1;
      info = result2;
  }
  </code></pre>
  
  <hr>
  
  <p>I've tried to use the following code in (button_Click) event handler :</p>
  
  <pre><code>private void submit_Button_Click(object sender, RoutedEventArgs e)
  {
      string Fullname = string.Empty, Info = string.Empty;
      int index = 132;
  
      Thread thread = new Thread(() =&gt; tempFunction(index, out Fullname, out Info));
      thread.Start();
      thread.Join();
  
      // I always use "MessageBox" to check if what I want to do was done successfully
      MessageBox.Show(Fullname + "\n" + Info);
  }
  </code></pre>
  
  <p>You can see that I use <code>thread.Join();</code> because I need to wait untill the Thread finishes to get the result of the threaded process.</p>
  
  <p>But the code above seems not working, it just freezes and I don't know why!</p>
  
  <p>So I'm definitely doing something wrong, can you tell me how to do what I want?</p>