I have an array of objects. The object has two properties a value and an index.
I use a linq to entities query with the contains keyword to bring back all results in a table that match up to value.
Now here is the issue… I want to match up the results to the object index…
what is the fastest best way to perform this. I can add properties to the object.
It is almost like I want the query results to return this:
index = 1;
value = "searchkey"
queryvalue = "query value"
From your question I think I can assume that you have the following variables defined:
Lookup[](You look-up array)IEnumerable<Record>(The results returned by your query)… and the types look roughly like this:
Then you can solve your problem in a couple of ways.
First using an anonymous type:
The other two just use standard LINQ
GroupBy&ToLookup:Do these solve your problem?