惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
WordPress大学
WordPress大学
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
爱范儿
爱范儿
小众软件
小众软件
MyScale Blog
MyScale Blog
美团技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
V
V2EX
量子位
云风的 BLOG
云风的 BLOG
A
About on SuperTechFans
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
C
Check Point Blog
月光博客
月光博客

博客园 - Anders06

A memory leak issue with WPF Command Binding 我也谈面试 附赠一份题目 败给了IEqualityComparer 标注随测量物体旋转问题 How to detect memory leak issue 图纸中角度标注算法 认真的程序员最可爱 Clean Code反案例:什么是不好的API 避免陷阱,重写Equals方法您需要注意的其中2个原则 What’s the problems with the following code 对象池 关于设计和设计文档的2个补充 ConverAll & Exists SOS:利用WPF RichTextBox 提取RTF, 莫名丢掉了Underline样式信息 想探讨两个关于设计文档问题 Don‘t Cry for Me, Argentina 拒绝高姿态 Please avoid implement C# Destruction SOS: How to popup a HwndSource on topmost
SelectMany
Anders06 · 2009-07-04 · via 博客园 - Anders06

string[] presidents = {
"Adams""Arthur""Buchanan""Bush""Carter""Cleveland",
"Clinton""Coolidge""Eisenhower""Fillmore""Ford""Garfield",
"Grant""Harding""Harrison""Hayes""Hoover""Jackson",
"Jefferson""Johnson""Kennedy""Lincoln""Madison""McKinley",
"Monroe""Nixon""Pierce""Polk""Reagan""Roosevelt""Taft",
"Taylor""Truman""Tyler""Van Buren""Washington""Wilson"}
;

IEnumerable
<char> chars = presidents.SelectMany(p => p.ToArray());

Employee[] employees = Employee.GetEmployeesArray();
EmployeeOptionEntry[] empOptions 
= EmployeeOptionEntry.GetEmployeeOptionEntries();

var employeeOptions 
= employees
                      .SelectMany(e 
=> empOptions
                                       .Where(eo 
=> eo.id == e.id)
                                       .Select(eo 
=> new {
                                                           id 
= eo.id,
                                               optionsCount 
= eo.optionsCount }
));

foreach (var item in employeeOptions)
   Console.WriteLine(item);