title: Question about List scope in C#
body: <p>I have a private function Load which creates a list, creates several objects and then binds a datagrid to the list. The code is similar to:</p>
  
  <pre><code>List&lt;Car&gt; cars = new List&lt;Car&gt;();
  cars.Add(new Car("Ford", "Mustang", 1967));
  cars.Add(new Car("Shelby AC", "Cobra", 1965));
  cars.Add(new Car("Chevrolet", "Corvette Sting Ray", 1965));
  _dgCars.DataSource = cars;
  </code></pre>
  
  <p>Now I would like to loop through the values in another private function. I tried something similar to:</p>
  
  <pre><code>foreach (Car car in cars) // Loop through List with foreach
  {
       // Need to access individual object properties here
  }
  </code></pre>
  
  <p>I am getting an error that cars does not exist in the current context. Is there a change I can make that will allow the List to be available globally? Perhaps I can define it elsewhere?</p>