Tag Archives: Contains

Like versus Contains in Linq

So have to figure this one out. Say you have: private static Expression<Func<User, Boolean>> WhereLikeFirstNameLastNameUserName(String name) { return currentUser => SqlMethods.Like(currentUser.UserName, “%” + name + “%”) || SqlMethods.Like(currentUser.FirstName, “%” + name + “%”) || SqlMethods.Like(currentUser.LastName, “%” + name + “%”); } And private static Expression <Func<User, Boolean>> WhereLikeFirstNameLastNameUserNameWithoutLike(String name) { return currentUser => currentUser.UserName.Contains(name) || [...]

Leave a comment Continue Reading →