var s = string.Join(",", products.Where(p => p.ProductType == someType)
.Select(p => p.ProductId.ToString()));
Using Linq to return a Comma separated string
var s = string.Join(",", products.Where(p => p.ProductType == someType)
.Select(p => p.ProductId.ToString()));