linq 多表连接测试
 
InBlock.gif                 static void Main( string[] args)
InBlock.gif                {
InBlock.gif                        var c1 = new List<KeyValuePair< int, int>>() { new KeyValuePair< int, int>(1, 1), new KeyValuePair< int, int>(2, 2), new KeyValuePair< int, int>(3, 3) };
InBlock.gif                        var c2 = new List<KeyValuePair< int, float>>() { new KeyValuePair< int, float>(0, 0f), new KeyValuePair< int, float>(1, 1.1f), new KeyValuePair< int, float>(2, 2.2f) };
InBlock.gif                        var c3 = new List<KeyValuePair< int, string>>() { new KeyValuePair< int, string>(2, "2"), new KeyValuePair< int, string>(3, "3"), new KeyValuePair< int, string>(4, "4") };
InBlock.gif
InBlock.gif                        var res = from x in c1
InBlock.gif                                            join y in c2 on x.Key equals y.Key
InBlock.gif                                            join z in c3 on y.Key equals z.Key
InBlock.gif                                            select new { o = x.Value, p = y.Value, q = z.Value };
InBlock.gif                        var _res = res.ToArray();
InBlock.gif                }
 
特点:
    1、多集合连接,建立在可判定相等键值基础上
    2、不断连接,缩小交集范围