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);
精彩评论