示例#1
0
        public void LinqQuery02_1()
        {
            var ls        = new LinqSamples();
            var customers = ls.GetCustomerList();
            var supplier  = ls.GetSupplierList();

            var result = from s in supplier
                         from c in customers
                         where s.Country == c.Country
                         where s.City == c.City
                         select new { Custumer = c, Suplier = s };

            ObjectDumper.Write(result, 1);
        }
示例#2
0
        public void LinqQuery02_2()
        {
            var ls        = new LinqSamples();
            var customers = ls.GetCustomerList();
            var supplier  = ls.GetSupplierList();

            var sup_country = from s in supplier
                              from c in customers
                              where s.Country == c.Country
                              where s.City == c.City
                              select new { Custumer = c, Suplier = s };
            var result = from s in sup_country
                         group s by s.Suplier.City into suplierGroup
                         select new { Customer = suplierGroup.Key, Suplier = suplierGroup };

            ObjectDumper.Write(result, 2);
        }