c#中的数据表形成 [英] datatable formation in c#

查看:53
本文介绍了c#中的数据表形成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据表就像是





BUS-1(0R02 BY 6530)ag square 01:00:00 10:00 :00

BUS-1(0R02 BY 6530)ag square 02:00:00 03:00:00

BUS-1(0R02 BY 6530)red cross bhavan 01 :00:00 04:00:00



i需要数据表如



BUS-1(0R02 BY 6530)ag square 01:00:00 10:00:00

02:00:00 03:00:00



BUS- 1(0R02 BY 6530)red cross bhavan 01:00:00 04:00:00

解决方案

完美,你有我们的许可,请继续。



既然你没有提出任何问题,很难给你一个更好的答案。



我强烈建议您阅读:

如何提出问题 [ ^ ]和什么你试过吗? [ ^ ]



PS写作解决方案,以避免这个问题在未答复的列表中


您需要使用Linq和GroupBy来做到这一点。

查看一些示例并尝试对于你的:

使用LINQ对来自DataTable的数据进行分组 [ ^ ]

LINQ - 分组运营商 [ ^ ]

my data table is like


BUS-1(0R02 BY 6530) ag square 01:00:00 10:00:00
BUS-1(0R02 BY 6530) ag square 02:00:00 03:00:00
BUS-1(0R02 BY 6530) red cross bhavan 01:00:00 04:00:00

i want datatable like

BUS-1(0R02 BY 6530) ag square 01:00:00 10:00:00
02:00:00 03:00:00

BUS-1(0R02 BY 6530) red cross bhavan 01:00:00 04:00:00

解决方案

Perfect, you have our permission, go ahead.

Since you didn't ask any question, it is difficult to give you a better answer.

I strongly recommend you to read:
How to ask a question[^] and What have you tried?[^]

P.S. Written as solution to avoid this "question" to be in the unanswered list


You need to use Linq and GroupBy to do that.
See some examples and try for yours:
Use LINQ to group data from DataTable[^]
LINQ - Grouping Operators[^]


这篇关于c#中的数据表形成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆