I'm here to ask a question on how would a code look like when it came to advanced filtering in C# with LINQ. I have experience with Linq, but this is something that was out of my understanding.
Lets say we have a class
List<Item> Results = list.where(item => item.Price> 10 && item.New).ToList();
You can define base query
var result = list.Where(item=> item.Price > 10); //DON'T Call ToList() here if(someCondition) result = result.Where(item=> item.New); //in the end you are calling return result.ToList();
Like @MikeEason said you don't want to call
ToList() on your first result because this will execute the query. Your goal is to build the complex query and execute it only once. Because of that this is done when you return the result.