LINQ & Entity
[UNION]두 시퀀스 연결(LINQ to SQL)
스티커
2010. 2. 25. 09:55
IQueryable<String> custQuery = (from cust in db.Customers select cust.Phone) .Concat (from cust in db.Customers select cust.Fax) .Concat (from emp in db.Employees select emp.HomePhone) ; foreach (var custData in custQuery) { Console.WriteLine(custData); }
var infoQuery = (from cust in db.Customers select new { Name = cust.CompanyName, cust.Phone } ) .Concat (from emp in db.Employees select new { Name = emp.FirstName + " " + emp.LastName, Phone = emp.HomePhone } ); foreach (var infoData in infoQuery) { Console.WriteLine("Name = {0}, Phone = {1}", infoData.Name, infoData.Phone); }