Using more than one condition in linq's where method

前端 未结 7 1412
南方客
南方客 2020-12-15 15:44

I have a line of code using where:

codebase.Methods.Where(x => x.Body.Scopes.Count > 5);

How can I insert more than one condition? So

相关标签:
7条回答
  • 2020-12-15 16:20

    In your example, where does y come from? The Where method takes a lambda with a single input parameter, which represents a single instance of the sequence you're operating against.

    You can, of course, have multiple conditions against x:

    Where(x => x.Foo > 5 && x.Bar < 3)
    
    0 讨论(0)
提交回复
热议问题