namespace CrossJoinSample
{
class Program
{
static void Main(string[] args)
{
string[] Departments = { "研發" , "會計" , "人事" , "資訊" };
string[] Employees = { "張三" , "李四" , "王五" };
var result = Departments.SelectMany(
e => Employees,
(d, e) => new {
Department = d ,
Employees = e
});
foreach (var item in result)
{
Console.WriteLine($"{item.Department} - {item.Employees}");
}
}
}
}
- 延伸閱讀
- [LINQ] SelectMany
沒有留言:
張貼留言