title: How does static code run with multiple threads?
body: <p>I was reading <a href="https://stackoverflow.com/questions/1511798/threading-from-within-a-class-with-static-and-non-static-methods">Threading from within a class with static and non-static methods</a> and I am in a similar situation.</p>
  
  <p>I have a static method that pulls data from a resource and creates some runtime objects based on the data.</p>
  
  <pre><code>static class Worker{
      public static MyObject DoWork(string filename){
          MyObject mo = new MyObject();
  
          // ... does some work
  
          return mo;
      }
  }
  </code></pre>
  
  <p>The method takes awhile (in this case it is reading 5-10mb files) and returns an object.</p>
  
  <p>I want to take this method and use it in a multiple thread situation so I can read multiple files at once. Design issues / guidelines aside, how would multiple threads access this code?</p>
  
  <p>Let's say I have something like this...</p>
  
  <pre><code>class ThreadedWorker {
      public void Run() {
          Thread t = new Thread(OnRun);
          t.Start();
      }
  
      void OnRun() {
          MyObject mo = Worker.DoWork("somefilename");
  
          mo.WriteToConsole();
      }
  }
  </code></pre>
  
  <p>Does the static method run for each thread, allowing for parallel execution?</p>