SelectMany
来源:互联网 发布:内衣取名知乎 编辑:程序博客网 时间:2024/06/14 00:52
private void button2_Click(object sender, EventArgs e)
{
List<List<int>> numbers = new List<List<int>>()
{
new List<int>{1,2,3},
new List<int>{4,5,6},
new List<int>{7,8,9}
};
var result = numbers.SelectMany(collection=>collection);
foreach(var item in result)
{
Console.WriteLine(item);
}
}
foreach (string i in "123".SelectMany(x => "123".Select(y => string.Format("a{0}b{1}c", x, y))))
Console.WriteLine(i);
1
2
3
4
5
6
7
8
9
a1b1c
a1b2c
a1b3c
a2b1c
a2b2c
a2b3c
a3b1c
a3b2c
a3b3c
string old="1/200;2/300;3/300;4/500;20/600;23/700;24/700;25/700;26/300";
var res1 = string.Join(";",
old.Split(';').Select(p =>
{
var t = p.Split('/');
return new { id = t[0], num = Convert.ToInt32(t[1]) };
})
.GroupBy(p => p.num)
.Select(p => string.Join("-", p.Select(c => c.id)) + "/" + p.Key.ToString())
);
Console.WriteLine(res1);
"1/200;2-3-26/300;4/500;20/600;23-24-25/700"
- SelectMany
- Select & SelectMany
- Linq中的SelectMany方法
- Linq之SelectMany
- Linq之SelectMany
- Select和selectMany
- Difference Between Select and SelectMany
- 如何在BackBean中使用SelectMany 对象
- linq里的select和selectmany操作
- IEnumerable.Select和SelectMany的区别
- Linq SelectMany和Select的用法
- Linq SelectMany和Select的区别
- IEnumerable.Select和SelectMany的区别
- 扩展方法SelectMany无重载单一方式实现示例
- 自己动手重新实现LINQ to Objects: 9 - SelectMany
- Linq 复合from子句和SelectMany扩展方法
- LINQ的经典例子-Where,Select、SelectMany、SkipWhile子句中使用数组索引
- LINQ的经典例子-Where,Select、SelectMany、SkipWhile子句中使用数组索引
- Chrome浏览器内部协议Chrome://收集
- 获取文件夹里的所有文件名称
- 用 c 语言实现类的继承,并且可用父类指针操作子类对像的一个测试例子
- 垃圾回收器 —— 获取内存
- jQuery 1.9,jQuery2.0 beta, Migrate插件的一些注意事項
- SelectMany
- ora-01031:insufficient privileges(权限不足)解决方法
- Android WebView缓存策略详解
- 人生若只如初见
- Android拨打、接听、挂断电话操作
- 学习笔记:c# 从“过程”看“对象”----类及基础的实现
- [vp8] [翻译][基本完工][求纠错润色]VP8的第一份深度技术分析
- 无限互联iOS开发视频教程,Objective-c基础部份,官方高清HD迅雷下载
- 方法论