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-에 원하는 속성을 선택하는 것입니다 anonymous-type-to-a-method http://stackoverflow.com/questions/6624811/how-to-pass-anonymous-types-as-parameters – dugas
이 타입을'IEnumerable'로 표현할 수 있습니다. 메서드에 대한 매개 변수 유형으로 할 수 있는지 확실하지 않지만? 더 나은 방법은'{a, b, c}'에 대한 클래스 유형을 만든 다음 'IEnumerable '으로 전달하는 것입니다. –
Porkbutts