I am looking for best practices for creating collections made from anonymous types.
There are several approaches - this one and most answers on this thread assume th
For a very different answer... LINQ?
In my case, I am iterating over a collection - for each item in the collection I would like to collect related objects in an anonymous type (acting as a tuple). I need these anonymous types to be put in a collection and then sort them for further work.
That sounds like:
var list = (from item in collection
from related in item.Relationship
order by ...something...
select new {item,related}).ToList()