Using Linq to return a Comma separated string

后端 未结 1 1643
一生所求
一生所求 2021-01-31 01:03

I have a class in my application

public class ProductInfo
{
  public int ProductId {get;set;}
  public int ProductType{get;set;}
}

I want to wr

相关标签:
1条回答
  • 2021-01-31 01:37
    var s = string.Join(",", products.Where(p => p.ProductType == someType)
                                     .Select(p => p.ProductId.ToString()));
    
    0 讨论(0)
提交回复
热议问题