Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

How to create linq query search from a list

$
0
0

I have a list of emails. I want to create a database query where I check if the query contains any of the emails and return them. My linq is not very good and i'm looking for help because this does not work:

IQueryable<Person> query = _context.Person;
List<string> emails = emailList;
foreach (var emailString in emails)
{
    query = query.Where(e => e.Epost == emailString);
}           

var personer = query.ToList();

any help? I'm just helpless when it comes to linq


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>