c# Inner Join sql 和 Enumerable.Join

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var list = new List<Man>() { new Man(){Id = "1",Name = "dds"},new Man(){Id = "2",Name = "aisd"},new Man(){Id = "3",Name = "232dfd"} };
            var keys = new List<string>(){"1","2"};
            var s = from m in list join key in keys on m.Id equals key select m ;
            var sel = list.Join(keys, i => i.Id, o => o, (m, n) => m);
            Console.WriteLine("Hello World!");
        }

        
    }

    class Man
    {
        public string Id { get; set; }

        public string Name { get; set; }
    }
}

 

posted @ 2018-08-20 11:30  Microestc-zl  阅读(390)  评论(0编辑  收藏  举报