Tech Off Post

Single Post Permalink

View Thread: LINQ to Entities and using a collection in the query...
  • User profile image
    MasterPi

    ulas said:
    stevo_ said:
    *snip*
    Ah, thanks for the link. I am pretty happy with the expressiveness of Linq in terms of simplifying a lot of mundane tasks one tends to do in code. It is just a bit of a downer to get everything compiling happily and then hit a runtime exception when the expression is evaluated. I realize, in a way, this is similar to trying to dividing one variable with another which may happen to be zero which would throw you a runtime exception but I just feel like checking which functions you use in the linq expression at compile time wouldn't be as difficult.
    You can use the lambda equivalent too:

    myDb.user.Where(x=>x.City.Equals(city)).Where(y=>y.Club.Contains(aClub));

    I think IntelliSense is better at helping you with the lambda.