Three conditions in linq where clause using lambda expressions
List<Tbl_MVPConsultant> _objConsultants = _datalayer.Get_MVP_Consultants();
_objConsultants = _objConsultants.Where(p => p.Country.ToLower().Contains(SearchTextbox.ToLower()) ||
p.State.ToLower().Contains(SearchTextbox.ToLower()) ||
p.City.ToLower().Contains(SearchTextbox.ToLower())).ToList();
I'm trying to achieve a filter operation three times using the above query .. but i'm getting an error stating object reference not set to an instance of an object ..
Looking for a quick solution.Appreciate early efforts. Thank you
_objConsultants = _objConsultants.Where(p => p.Country.ToLower().Contains(SearchTextbox.ToLower()) || p.State.ToLower().Contains(SearchTextbox.ToLower())).ToList();I was able to fetch the results based on the two conditions but fails for the three condition statement.. @Niranjan Kala