开发者

Like Operator equivalent in LINQ

I need to use the like operator in a LINQ query

For this:

timb = time.Timbratures.Include("Anagrafica_Dipendente")
                .Where(p => p.Anagrafica_Dipendente.Cog开发者_运维问答nome + " " + p.Anagrafica_Dipendente.Nome like "%ci%");

How can I do this?


timb = time.Timbratures.Include("Anagrafica_Dipendente")
           .Where(p => (p.Anagrafica_Dipendente.Cognome + " "
                       + p.Anagrafica_Dipendente.Nome).Contains("ci"));


You can use Contains() for this like so:

var query = (from p in products
            where p.Description.Contains("ci")
            select p);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜