How to do a STAR search in LINQ
I'm not sure about clarity of the STAR word.
I'm implementing a search method using linq-to-object in c#. And I want to do a search with * (star) operator like most of searc开发者_运维百科h apps or web can do.e.g.
If I typed "p*", results should be everything starting with "p". And it should work for prefix star, suffix star or star in the middle.And it would be great if the search can do with
"-" (minus/NOT) operator or "+" (plus/OR) operator or "AND" operatorThanks in advance.
please check regular expresions linq with regex
items.Where(x => x.StartsWith("p"));
or
from x in items where x.StartsWith("p") select x
精彩评论