I have a collection that I'm gathering from a linq query and I'd like to use that collection as a join for another query. How do I do that?
Thanks
LINQ 101 Samples
Copied LINQ statements from here
string[] categories = new string[]{ 
    "Beverages", 
    "Condiments", 
    "Vegetables", 
    "Dairy Products", 
    "Seafood" };
List<Product> products = GetProductList();
var q =
    from c in categories
    join p in products on c equals p.Category
    select new { Category = c, p.ProductName };
foreach (var v in q)
{
    Console.WriteLine(v.ProductName + ": " + v.Category);
}
Try this
var query2 = from c in db.YourTable
        join q in query1 on c.Id equals q.Id
        select c;
Where query1 wats your first collection that originated from a linq query.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With