Hi I get the data in products from below query but i again want products to get filtered and store that data in another Ilist name product1. I had written below code but it snot working, can any bodyu help me out?
IList<Product> products = ProductDataSource.FindProducts();//store data in list of products
IList<Product> products1 = products.SingleOrDefault(s => s.Visibility == 2));
SingleOrDefault does not produce a List, it produces a single item (or null).
So it should be:
Product product = products.SingleOrDefault(s => s.Visibility == 2);
Or if you do need a List:
IList<Product> products1 = products.Where(s => s.Visibility == 2).ToList();