Пример #1
0
        static IEnumerable <Employee> JoinTest()
        {
            LinqTest linqTest = new LinqTest();
            var      result   = from l1 in linqTest.list1
                                join l2 in linqTest.list2 on l1.Name equals l2.Name
                                select l1;

            return(result);
        }
Пример #2
0
        static IEnumerable <dynamic> JoinDynamicTest()
        {
            LinqTest linqTest = new LinqTest();
            var      result   = from l1 in linqTest.list1
                                join l2 in linqTest.list2 on l1.Name equals l2.Name
                                select new { l1, l2.Age };

            return(result);
        }
Пример #3
0
        static IEnumerable <dynamic> LeftJoinTest()
        {
            LinqTest linqTest = new LinqTest();
            var      result   = from l1 in linqTest.list1
                                join l2 in linqTest.list2 on l1.Name equals l2.Name
                                into l1l2
                                from x in l1l2.DefaultIfEmpty()
                                select new { l1, x.Name };

            return(result);
        }
Пример #4
0
        static void Main1(string[] args)
        {
            //LinqTest.JoinTest();

            LinqTest.JoinDynamicTest();
        }