Passing a generic list to a method
<p>I have an application that will parse an excel file and add a column, then generate a new CSV file with the results.  I am able to create a list of the items I want in the file, but I cannot figure out how to pass that list to the method that is generating the new file.</p>

<p>I have the following class:</p>

<pre><code>public class LocationData
{
    public string PostalCode { get; set; }
    public string Partner { get; set; }
    public string LocationID { get; set; }
    public string Name { get; set; }
    public string Country { get; set; }
    public string Market { get; set; }
}
</code></pre>

<p>and the following code to get the data into a list:</p>

<pre><code>LocationData Locationdata = new LocationData()
{
    PostalCode = location[0],
    Partner = location[1],
    LocationID = location[2],
    Name = location[3],
    Country = location[4],
    Market = repository.GetMarketsForPostalCode(location[0])
}
</code></pre>

<p>I also have the method to create the csv and I need to pass in the list info, but I get the error:</p>

<blockquote>
  <p>foreach statement cannot operate on variables of type 'app.LocationData' because 'app.LocationData' does not contain a public definition for 'GetEnumerator'</p>
</blockquote>
