Make the right condition with LINQ
-
There's an OBD in one table where 3 fields: ID, English word, translation.
For one of the purposes, I'm counting only verbs with that expression. All the verbs start with the "To" part.
words = wordsfromDB.Where(w => w.EnglishWord.StartsWith("To")).ToList();
Now I want to realize the possibility of counting only phrase verbs, I mean, "To give" doesn't count, and "To give up" counts.
I mean, he has to count all the records that start on "To" and that Have at least three words.
Help me make the right condition.
-
Don't use regular expressions without special need. There's an operator in both pure SQL and LINQ to SQL for such requests.
LIKE
which also allows for the selection of text boxes:words = wordsfromDB.Where(w => SqlMethods.Like(w.EnglishWord, "To % up")).ToList();
It's done in order faster than the SQL's "bones" with regular expressions.
In fact, the task is to look at a full-text search. There are both extended text requests and gramatic-collar kernels, not just English.