using System.Collections.Generic;
public static void Main()
var animals = new List<Animal> {
new Animal { Name = "Cat", XChromosome = "X", YChromosome = "Y" },
new Animal { Name = "Bat", XChromosome = "XX", YChromosome = "Y" },
new Animal { Name = "Dog", XChromosome = "X", YChromosome = "YY" }
var properties = new List<Properties> {
new Properties { Name = "Dog", Prop1 = "Bark", Prop2 = "Brown" },
new Properties { Name = "Mouse", Prop1 = "Pi", Prop2 = "Grey" },
new Properties { Name = "Cat", Prop1 = "Mew", Prop2 = "Black" },
new Properties { Name = "Cat", Prop1 = "Moo", Prop2 = "White" }
var matches = from a in animals
join p in properties on a.Name equals p.Name into g
from p in g.DefaultIfEmpty()
Prop1 = p == null ? null : p.Prop1,
Prop2 = p == null ? null : p.Prop2
foreach(var match in matches)
Console.WriteLine("{0} [{1}-{2}]: {3} {4}", match.Name, match.XChromosome, match.YChromosome, match.Prop1, match.Prop2 );
public string Name { get; set; }
public string XChromosome { get; set; }
public string YChromosome { get; set; }
public string Name { get; set; }
public string Prop1 { get; set; }
public string Prop2 { get; set; }