If condition in LINQ Where clause

var query = someList.Where(a => (someCondition)? a == "something" : true);

so, if ‘someCondition’ is false, ‘Where’ will be skipped.

Leave a Comment