[英]c# LINQ joining to comma separated string
我有一串逗號分隔值,稱為driverids。
我應該使用逗號分隔列表或此逗號分隔列表來自的數組來在連接中使用它。
我如何在linq中使用這些驅動程序的連接?
_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.........
你會做這樣的事情(假設_currentDriverData
是一個id列表):
_currentDriverData.AddRange(commaSeparatedString.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyElements).ToList());
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.