开发者

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" operator

Thanks 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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜