using System.Collections.Generic;
private static List<EmployeeDetails> employeeDetails = new List<EmployeeDetails> {
new EmployeeDetails(1, "350 Buckaway Drive"),
new EmployeeDetails(2, "12 Main St"),
new EmployeeDetails(3, "78 Westhurst Road")
private static List<EmployeeName> employeeNames = new List<EmployeeName> {
new EmployeeName(1, "John Doe"),
new EmployeeName(2, "Bambi Granger"),
new EmployeeName(3, "James McElroy")
static void Main(string[] args)
List<Employee> employees = employeeDetails.Select(x => new Employee(x.Id, "X", null)).ToList();
throw new Exception("There are no employees!");
if (employees.Count != employeeDetails.Count)
throw new Exception("There are not enough employees!");
foreach(var employee in employees)
if (string.IsNullOrEmpty(employee.Address) || string.IsNullOrEmpty(employee.Name))
throw new Exception("Employee data incomplete!");
Console.WriteLine(employee);
public class EmployeeName
public int Id { get; set; }
public string Name {get ; set; }
public EmployeeName(int id, string name)
public class EmployeeDetails
public int Id { get; set; }
public string Address { get ;set; }
public EmployeeDetails(int id, string address)
public int Id { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public Employee(int id, string name, string address)
public override string ToString()
return $"{Id} - {Name} - {Address}";