根据字段的长度排除结果

Her*_*rn_ 0 c# sql linq

以下是我的LINQ查询:

 list = (from i in context.Cars
    .Where(c => terms.All(t => c.Code.Contains(t) || c.ShortDescription.Contains(t) 
    && c.Code.Replace(" " , "").Length >3))
    select new Model.Cars
    {
        CarId = i.CarId,
        ShortDescription = i.ShortDescription,
        Code = i.Code
    }).Take(250).ToList();\
Run Code Online (Sandbox Code Playgroud)

其中一个业务要求是排除代码长度小于3的任何记录.很多这些代码中都有空格,这就是为什么我将""替换为""的条款.这在我的查询中似乎不起作用.我仍然得到代码长度为3的结果.我应该只得到代码长度大于3的结果.几乎看起来替换不是替换没有空格的空格.其他一切都有效.我究竟做错了什么 ?

15e*_*153 5

运营商优先级再次发生.

.Where(c => 
    terms.All(t => 
        ( c.Code.Contains(t) || c.ShortDescription.Contains(t) )
        && c.Code.Replace(" " , "").Length > 3
    )
)

if (true || true && false)
    MessageBox.Show("Gotcha!");
Run Code Online (Sandbox Code Playgroud)