Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用
string.join(", ",)
在 linq 查询中选择内部
它给出错误,因为 LINQ to Entities 无法识别该方法
'System.String Join(System.String, System.String[])'
只有在枚举结果后才有可能,调用它 ToList() 然后使用 String.Join
IE
var result = db.Person .Include("Occupations") .ToList() .Select(q=> new { Name = q.Name, Occupations = string.Join(", ", q.Occupations.Select(x=>x.Name)) });