var emp = (from a in AdventureWorks.PersonPhones
join b in AdventureWorks.People
on a.BusinessEntityID equals b.BusinessEntityID
join c in AdventureWorks.PhoneNumberTypes
on a.PhoneNumberTypeID equals c.PhoneNumberTypeID
select new { a, b, c }).OrderBy(n => n.c.Name);
我有这个linq查询选择匿名类型的值。 我只想将这个查询传递给somemethod(),并在该方法中存储在“emp”中的此查询上调用toList()。 谢谢!通过linq选择查询的方法
http://stackoverflow.com/questions/55101/how-can-i-pass- an-anonymous-type-to-a-method http://stackoverflow.com/questions/6624811/how-to-pass-anonymous-types-as-parameters – dugas
您可以将此类型表示为'IEnumerable'。虽然我不确定您是否可以将它作为方法的参数类型?更好的是,为什么不为'{a,b,c}'创建一个类类型,然后将其作为'IEnumerable '传递给它? –
Porkbutts