using System.Collections.Generic;
public static void Main()
List<TableA> data1 = new List<TableA>
new TableA { AID =1, AName = "Test1" },
new TableA { AID =2, AName = "Test2" },
new TableA { AID =3, AName = "Test3" },
List<TableB> data2 = new List<TableB>
new TableB { BID =1, AID = 1, BName = "XYZ" },
new TableB { BID =2, AID = 1, BName = "JKL" },
new TableB { BID =3, AID = 2, BName = "ABC" },
var query = from a in data1
join b in data2.Where(x => x.BID == 3)
on a.AID equals b.AID into ab
from c in ab.DefaultIfEmpty()
BName = c == null ? "No Records" : c.BName
foreach (var data in query)
Console.WriteLine("AID : {0} , AName: {1}, BName : {2}", data.AID, data.AName, data.BName);
public int AID { get; set; }
public string AName { get; set; }
public int BID { get; set; }
public int AID { get; set; }
public string BName { get; set; }