3

I'm using the Visual Studio 2010 RC for .NET 4.0 and I'm trying to figure out how to do a wildcard comparison with Entity Framework.

I'd like to have the following query for EF where I find all the names that start with 'J'

select * from Users where FirstName like 'J%'
Ryan Gates
  • 4,442
  • 5
  • 49
  • 87
Paul Mendoza
  • 5,581
  • 12
  • 52
  • 82

3 Answers3

9
from user in Users where user.FirstName.StartsWith("J") select user;
David Morton
  • 15,960
  • 2
  • 61
  • 72
3

Use:

var query = Users.Where(user => user.FirstName.StartsWith("J"));
Ahmad Mageed
  • 91,579
  • 18
  • 159
  • 169
0

I would refer you to this question, I assume it hasn't changed in .net 4.0

Community
  • 1
  • 1
csjohnst
  • 1,668
  • 2
  • 18
  • 24