63
var result = employees.SelectMany(w => w.Departments);
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
5
6
namespace ConsoleApplication1
7
{
8
public class Employee
9
{
10
public int ID { get; set; }
11
public string Name { get; set; }
12
public List<Department> Departments { get; set; }
13
}
14
15
public class Department
16
{
17
public string Name { get; set; }
18
}
19
20
public class Program
21
{
22
public static void Main(string[] args)
23
{
24
List<Employee> employees = new List<Employee>();
Cached Result
Hello India