title: What benefits are there to using an instance variable vs passing a parameter?
body: <p>When building classes, my rule of thumb has always been to pass parameters, unless the caller has no access to them. For example, I always prefer this:</p>
  
  <pre><code>class Foo
  {
      private FooData _data;
      public Foo(FooData data) { _data = data; }
  
      public string GetSomeValue()
      {
          var result = ProcessData(_data);
          return result;
      }
  
      private static string ProcessData(FooData data)
      {
          // do something with data and return the result
      }
  }
  </code></pre>
  
  <p>Over this:</p>
  
  <pre><code>class Foo
  {
      private FooData _data;
      public Foo(FooData data) { _data = data; }
  
      public string GetSomeValue()
      {
          var result = ProcessData();
          return result;
      }
  
      private string ProcessData()
      {
          // do something with _data and return the result
      }
  }
  </code></pre>
  
  <p>I have come across the second example many times in the wild, and I have never identified a good reason. <strong>What are the benefits and drawbacks of accessing instance variables vs. using method arguments?</strong></p>
  
  <p><strong>UPDATE:</strong> I realize that some answers to this question may be opinion based, but I am looking for things that one approach can do that the other can't so I can form my own opinion about when to use each one. </p>
  
  <p>For example:</p>
  
  <ul>
  <li>The second method allows for shorter, more readable code. </li>
  <li>The first method ensures that data is not changed when processing.</li>
  </ul>