It is really looks so cool to me how GridView’s DataSource property gets anonymous type and shows results in Grid .
Simply
Grid.DataSource = from order in db.OrdersSet
select new { order.PersonSet.Name,order.PersonSet.SurName};
For example how can i write a propery or method which takes anonymous type and write field values to console output ?
With reflection…
If you have an instance of an anonymous type, you can hold it in a variable of type
object, callGetType()on it, and thenGetFields,GetProperties, etc. to find out what columns are associated with it. EachPropertyInfoorFieldInfoyou see has the capability to retrieve the value from any instance of the type.