c# - Does LINQ have any built-in search which supports search-machine-like searching? -
If I have list
and want to do a standard search through it, I can use a LINQ statement like this:
(In functions where searchTerms.All (term = & Gt; t.ToUpper. It contains (term.ToUpper ())) Select .to create list ();
But if I want to support syntax like standard search-engine to handle phrases:
contract contract customer gym customer "Jim Smith "Customer
then I have to start rolling my own custom search method. In addition, you may have different culture settings Be careful to compare ToUpper () with, and if you are in the web environment, then you have
Handles search-machine-like searches, e.g. Is there a .NET or LINQ solution that contains something like ConstainsSearchTerms () instead of ()?
If you are using LINQ2SQL, you generate a generated like in SQL You can use the SqlMethods.Like
methods to do this.
Leave on LINQ2Objects, just use regex.
toupper
. This is problematic, better solution is to use string case folding, but unfortunately .NET only supports simple models: (
Comments
Post a Comment