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.
我的应用程序中有一个类
public class ProductInfo { public int ProductId {get;set;} public int ProductType{get;set;} }
我想编写一个 linq 查询,它可以以逗号分隔的格式返回 ProductIds 列表,其中 ProductType 等于某个数字?
我尝试将 string.join 与我的 Linq 语句一起使用,但它似乎不起作用。
var s = string.Join(",", products.Where(p => p.ProductType == someType) .Select(p => p.ProductId.ToString()));