This is a migrated thread and some comments may be shown as answers.

I am stumped by this :) ...

2 Answers 10 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 04 Jun 2014, 03:23 PM
Okay so here's the problem...

I have a column\property called "Site" of type string

I also have a List<string> with 3 items in it

So I need to return all the objects whos "Site" has any of the strings in the List.

Does that make sense?

2 Answers, 1 is accepted

Sort by
0
Accepted
Viktor Zhivkov
Telerik team
answered on 06 Jun 2014, 03:46 PM
Hello Steve,

You can easily implement such query using IEnumerable.Contains():
List<string> siteList = new List<string>() { "site1", "site2", "site3" };
var query = from c context.Endpoint
         where siteList.Contains(c.Site)
         select c;

You can find more information about our implementation for handling IEnumerable.Contains() in this online documentation article.

Regards,
Viktor Zhivkov
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 06 Jun 2014, 04:12 PM
GAH, yeah that was it, thx :)
Tags
LINQ (LINQ specific questions)
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Viktor Zhivkov
Telerik team
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Share this question
or