Reputation: 35693
i can simply get one item of an array by
string myKeyword="test";
GridView1.DataSource = from e in table where e.Keyword.Equals(myKeyword) select e;
how can i extend it to an array? I want something like:
string[] myKeywords={"test1", "test"};
GridView1.DataSource = from e in table where e.Keyword.Equals(myKeywords) select e; // something like this?
i want to get all elements where the Keyword is equal to one of the the Keywords in myKewords
Upvotes: 2
Views: 1828
Reputation: 632
string[] temp = (from e in table
join k in myKeywords on e.Keyword equals k
select e.Keyword).ToArray();
Upvotes: 0
Reputation: 437336
You need to use the Enumerable.Contains
method:
var temp = (from e in table where myKeywords.Contains(e.Keyword)).ToArray();
Upvotes: 10