using System; using System.Collections.Generic; using System.Linq; public class Province { public string province { set; get; } public Nullable provinceCode { set; get; } } public class Zone { public string CityCode { get; set; } public string City { get; set; } public string Province { get; set; } public Nullable ProvinceCode { get; set; } } public class ZoneTest { public static void Main() { List ZoneList = new List(); Zone newZone = new Zone() { CityCode = "citycode1", City = "city1", Province = "province1", ProvinceCode = 1 }; ZoneList.Add(newZone); newZone = new Zone() { CityCode = "citycode2", City = "city2", Province = "province2", ProvinceCode = 2 }; ZoneList.Add(newZone); newZone = new Zone() { CityCode = "citycode2", City = "city2", Province = "province2", ProvinceCode = 2 }; ZoneList.Add(newZone); Console.WriteLine(ZoneList[0].ProvinceCode); Console.WriteLine(ZoneList[1].ProvinceCode); Console.WriteLine(ZoneList[2].ProvinceCode); List ListZoneWithDistinct = ZoneList.GroupBy(x => new {x.Province, x.ProvinceCode}).Select(grp => new Province() {province = grp.First().Province, provinceCode = grp.First().ProvinceCode}).ToList(); Console.WriteLine("Count after Distinct: " + ListZoneWithDistinct.Count); Console.WriteLine(ListZoneWithDistinct[0].provinceCode); Console.WriteLine(ListZoneWithDistinct[1].provinceCode); } }