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

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -