Articles in categories


Sort List of T

How to sort a List:


How to sort a List of objects descending:

Products.GetAllProducts().OrderByDescending(p => p.Code).ToList();

How to sort a List of objects ascending:

Products.GetAllProducts().OrderBy(p => p.Code).ToList();

How to filter a List with an sql LIKE operator:

List<Product> products = new List<Product>();
products = ProductList.Where(p => p.Code.ToLower().Contains("searchString".ToLower())).ToList();