c# - Need to search multiple words using linq -


i have requirement user comes , enters search words based on need query using linq , display records. eg goes here:

search eg 1: "infosys" if user enters infosys search term can use contains , result easily.

eg 2: "tata consultancy services" if user enters can still use contains , record easily. catch if user enters "tata services" or grammitical mistake "tata constult service" still want show records consists of of 3 words. either tata/consutult/service.

this search dynamic , not restricted 3 array. can split words space.

use any extension method:

string querystring = "tata services"; var queryparts = querystring.split(' '); var result = records.where(r => queryparts.any(p => r.name.contains(p))); 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -