【问题标题】:Like Operator equivalent in LINQ类似于 LINQ 中的等效运算符
【发布时间】:2010-04-28 10:57:03
【问题描述】:

我需要在 LINQ 查询中使用 like 运算符

为此:

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

我该怎么做?

【问题讨论】:

    标签: asp.net entity-framework linq sql-like


    【解决方案1】:
    timb = time.Timbratures.Include("Anagrafica_Dipendente")
               .Where(p => (p.Anagrafica_Dipendente.Cognome + " "
                           + p.Anagrafica_Dipendente.Nome).Contains("ci"));
    

    【讨论】:

      【解决方案2】:

      您可以像这样使用 Contains():

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-04-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-07-06
        • 1970-01-01
        相关资源
        最近更新 更多