Q:

How can I retrieve all property values from a list of common objects?

I want to retrieve all single properties from a collection as an array:
class Foo{
   public string Bar { get; set; }
   public string Baz { get; set;}
}

I want to get i.e. all Bar properties from the collection 
var list = new List<Foo>();

string[] allBars = list. .... 

and how does it go on???
Thanks for any help.

A:

You can use:
string[] allBars = list.Select(foo => foo.Bar).ToArray();

I would only convert this to an array if you specifically need it to be in an array.  If your goal is just to output the "Bar" list, you could just do:
var allBars = list.Select(foo => foo.Bar); // Will produce IEnumerable<string>
foreach(var bar in allBars)
{
    // Do something with bar
}

