4 using System
.Collections
.Generic
;
15 public static int Main ()
17 Data
[] d1
= new Data
[] { new Data () { Key = 1, Value = "First" }
};
18 Data
[] d2
= new Data
[] {
19 new Data () { Key = 1, Value = "Second" }
,
20 new Data () { Key = 1, Value = "Third" }
25 join b
in d2 on a
.Key equals b
.Key
26 select new { Result = a.Value + b.Value }
;
28 var res
= e
.ToList ();
32 if (res
[0].Result
!= "FirstSecond")
35 if (res
[1].Result
!= "FirstThird")
39 join b
in d2 on a
.Key equals b
.Key
40 where b
.Value
== "Second"
41 select new { Result = a.Value + b.Value }
;
47 if (res
[0].Result
!= "FirstSecond")
52 join Data b
in d2 on a
.Key equals b
.Key
53 select new { Result = a.Value + b.Value }
;
59 if (res
[0].Result
!= "FirstSecond")
62 if (res
[1].Result
!= "FirstThird")
65 var e2
= from Data a
in d1
66 join b
in d2 on a
.Key equals b
.Key
69 var res2
= e2
.ToList ();
73 if (res2
[0].Key
!= 1)
76 Console
.WriteLine ("OK");