I wrote multiple linq statement ... and how it make as single linq statement.. and my code is given below
- if (Filter != " ")
- {
- details = (from e in Country_Details where e.Country.ToLower().StartsWith(Filter.ToLower()) select e).ToList();
- if (details.Count <= 0)
- {
- details = (from e in Country_Details where e.Capital.ToLower().StartsWith(Filter.ToLower()) select e).ToList();
- if (details.Count <= 0)
- {
- details = (from e in Country_Details where e.Region.ToLower().StartsWith(Filter.ToLower()) select e).ToList();
- if (details.Count <= 0)
- {
- details = (from e in Country_Details where e.S_region.ToLower().StartsWith(Filter.ToLower()) select e).ToList();
- }
- }
- }
- }
4 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.


Priyanka K SPosted Dec 27, 2019, 5:26 AM