Linq dynamically adding where conditions

前端 未结 3 396
一生所求
一生所求 2020-12-03 16:23

I have a gridview which has drop down boxes in each header for filtering. Each filter is loaded with the distinct values from its column when loaded. At run time, I add \"AL

3条回答
  •  旧时难觅i
    2020-12-03 17:02

    Create extension method(s) which encapsulate the where logic so it looks cleaner:

    var filteredList = allQuotes.WhereDropOwnersAreContained()
                                .WhereCompanyIsContained()
                                ...
                                ;
    

提交回复
热议问题