Reputation: 701
I have this linq
query-
Where string Creative
and Artistic
would be match.
It is a query of records where particular record contains any of these string matches.
Query-
Public ActionResult Creative(){
string[] stringArray = {"Creative","Artistic"};
var creativelist = (from u in db.CardTables
Where u.TagName.Any(stringArray.Contains)
select SomeModel{})
.ToList();
}
I want to select where column TagName
contains any of these strings or both.
Upvotes: 0
Views: 121
Reputation: 9947
if this has to be done using lambda then i would do like
var creativelist = db.CardTable.Where(x=>stringArray.Contains(x.TagName)).ToList()
so in your case
string[] stringArray ={"Creative","Artistic"};
var creativelist = (from u in db.CardTables
where stringArray.Contains(u.TagName))
Upvotes: 1
Reputation: 9024
string[] stringArray ={"Creative","Artistic"};
var creativelist = (from u in db.CardTables
where stringArray.Contains(u.TagName))
Upvotes: 2