> example from ms web site.... > > public void Linq15() { > List customers = GetCustomerList(); > > var orders = > from c in customers, > o in c.Orders > where o.Total < 500.00M > select new {c.CustomerID, o.OrderID, o.Total}; > > ObjectDumper.Write(orders); > } > > unfortunately my 2008 compiler doesn't seem to like it....it complains > about the ","....I suspect the syntax has changed...I suspect I need > a "join" somewhere, but then it expects some sort of "on" clause, which I > can't really supply as the o is correlated by the "." in "c.order".
you could do it this way, if fetching from the db var orders = from o in Orders where o.Total < 500.00M select new {o.CustomerID, o.OrderID, o.Total}; as customerID is an FK in order to customer, so customer isn't needed here. If you have the objects in a graph in memory, you could use nested from clauses: var orders = from c in customers from o in c.Orders where o.Total < 500.00M select new {c.CustomerID, o.OrderID, o.Total}; (haven't checked it for compile errors, though should work) FB =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com