Created
February 13, 2012 15:31
-
-
Save breezhang/1817617 to your computer and use it in GitHub Desktop.
Enumerable Join some stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//need .net 4.0 | |
var s1 = Enumerable.Range(1, 10).ToList().Select(i => new {name = i%7,sex =i,age= i*10}); | |
var s2 = Enumerable.Range(1, 10).ToList().Select(i => new {name = i & 0xFE}); | |
var result = s2.Join(s1, arg => arg.name, arg => arg.name, (a, b) => b).Distinct(); | |
if(result.Any()) | |
{ | |
result.ToList().ForEach(obj => _show(obj.name + "/"+ obj.sex + "/" + obj.age));//+"/" + obj.b)); | |
} | |
/*------result | |
0/7/70 | |
2/2/20 | |
2/9/90 | |
4/4/40 | |
6/6/60 | |
--------------*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment