title: Create comma separated list from list of objects
body: <p>I have list of objects type Person. This class has many properties and I need them all in a comma separated list so I can use it later for Csv file.</p>
  
  <p>I've managed this with foreach and adding each property, separating it with commas manual, etc.</p>
  
  <pre><code>const string commaSeparator = ",";
  foreach (var item in individualsInformation)
  {
      csv.AppendLine(item.ReferenceNumber + commaSeparator + item.FirstName + commaSeparator +
                     item.Surname + commaSeparator + item.MiddleName + commaSeparator +
                     item.Address1 + commaSeparator + item.Address2 + commaSeparator + 
                     item.Address3 + commaSeparator + item.Address4 + commaSeparator + 
                     item.City + commaSeparator + item.PostalCode + commaSeparator +
                     item.Country + commaSeparator + item.DateOfBirth.ToString() + commaSeparator +
                     item.ID + commaSeparator + item.Gender + commaSeparator +
                     item.Component + commaSeparator + item.NationalID + commaSeparator + 
                     item.SubSystemID + commaSeparator + item.System);
  }
  </code></pre>
  
  <p>Then I've realized that there is much efficient way, by using string.Join</p>
  
  <p>This does not work of course:</p>
  
  <pre><code>string joined = string.Join(",", listOfPersons);
  </code></pre>
  
  <p>And if I go by selecting property like this:</p>
  
  <pre><code>string joined = string.Join(",", listOfPersons(x =&gt; x.Id);
  </code></pre>
  
  <p>I get comma separated list only for that property of course.</p>
  
  <p>Is there some more efficient way for getting each property separated by comma?</p>