For this example I have a Man object. A property of the Man object is a generic list of Dog objects. Each Dog object also has a generic list of just strings.

I am grabbing a property from the main object, Man and then digging down into the Man object's associated Dog list to grab the bones property of each Dog object in that list. However, when ever I print to console I keep on getting this (the number of bones (property) is never being printed:


1st example

Output:

Name: Josh

Bones: System.Linq.Enumerable+WhereSelectListIterator'2[Dog, System.Int32]



var allMen =
from man in lstMan
select new
{
manname = man.name,
bonenum = man.dogs.Select(p=>p.bones)
};

2nd example

This also occurs in this example where I'm using Group By:


var registeredMen =
from man in lstMan
group man by man.name into mangrp
select new
{
studen = mangrp.Key,
vals = mangrp.SelectMany(p=>p.listofStrings)

};


Output:

Jake

System.Linq.Enumerable+<SelectManyIterator>d__14'2[Course,System.String]


Can anyone tell me what I'm doing wrong in each example?