linq连接表与集合

use*_*807 4 linq

我有一个我从linq查询中收集的集合,我想将该集合用作另一个查询的连接.我怎么做?

谢谢

xsc*_*ape 6

LINQ 101样品

这里复制LINQ语句

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);
}
Run Code Online (Sandbox Code Playgroud)