title: C# How can I identify the method that created the thread the current method is in?
body: <p>I'm looking to identify the method that created the Thread that the current method is running in.</p>
  
  <p>I would use new StackFrame(int).GetMethod().Name, but I'm in a new Thread at the time of running this, so this one is out.</p>
  
  <p>An example of my code is below:</p>
  
  <pre class="lang-cs prettyprint-override"><code>private void doSomething(object sender, EventArgs e)
  {
      try
      {
          Thread thread = new Thread(new ParameterizedThreadStart(GenerateThreadMethod));
          thread.Start(new Dictionary&lt;String, Object&gt;() {
              { "date" , Convert.ToDateTime(monthCalendar.SelectionRange.Start)},
              { "path", myList[myListBox.SelectedIndex][1] }
          });
      }
      catch (Exception ex)
      {
          MessageBox.Show(ex.ToString());
      }
  }
  
  
  private void GenerateThreadMethod(Object obj)
  {
      Dictionary&lt;String, Object&gt; data = (Dictionary&lt;String, Object&gt;)obj;
  
      DateTime date = (DateTime)data["date"];
      String path = (String)data["path"];
  
      //I want to find the name of doSomething() right here
  
      doMoreThings(date, path);
  }
  </code></pre>