c# - Using Linq to return a Comma separated string -
i have class in application
public class productinfo { public int productid {get;set;} public int producttype{get;set;} }
i want write linq query can return me list of productids in comma separated format producttype equal number ?
i tried using string.join linq statement didn't seem work.
var s = string.join(",", products.where(p => p.producttype == sometype) .select(p => p.productid.tostring()));
Comments
Post a Comment