C# LINQ 连接到逗号分隔的字符串
我有一串逗号分隔的值,称为 driverids。
我应该使用逗号分隔列表还是这个逗号分隔列表来自的数组来在连接中使用它。
我如何在 linq 中使用连接到这些驱动程序 ID?
_currentDriverData.AddRange(elementsCurrent.Join(driverids)
// gets distinct driver ids from the driver duty status change logs;
string driverids = string.Join(",", _logsDutyStatusChange
.Select(item => item.did)
.Distinct()
.ToArray());
//gets all current driver information
//_currentDriverData.AddRange(elementsCurrent.Where(drivers)
_currentDriverData.AddRange(elementsCurrent.Join(driverids).Select.........
I have a string of comma separated values called driverids.
Should I use the comma separated list or the array that this comma separated list comes from to use this in a join.
How would I use a join in linq to these driverids?
_currentDriverData.AddRange(elementsCurrent.Join(driverids)
// gets distinct driver ids from the driver duty status change logs;
string driverids = string.Join(",", _logsDutyStatusChange
.Select(item => item.did)
.Distinct()
.ToArray());
//gets all current driver information
//_currentDriverData.AddRange(elementsCurrent.Where(drivers)
_currentDriverData.AddRange(elementsCurrent.Join(driverids).Select.........
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你会做这样的事情(假设 _currentDriverData 是一个 id 列表):
You would do something like this (assuming
_currentDriverData
us a list of ids):