i have repeated data in Target class list
new TargetClass{ TID=102, ID=2, Adress="afff", Zip="222"},
new TargetClass{ TID=103, ID=2, Adress="bfff", Zip="222"},
i need reated ID's Data from li2 how can i do that? for example ıD=2 is repeated like ID = 3i want to take 2,3 (ID) detail in li2? How can i do that with linq?
code>namespace TestEng2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { List<MyClass> li1 = new List<MyClass>() { new MyClass { ID = 1, Name = "yusuf", SurName = "karatoprak" }, new MyClass{ ID =2, Name ="ali", SurName="kara" }, new MyClass{ ID =3, Name ="Oliver", SurName="gdfgfd" }, new MyClass{ ID =4, Name ="Khan", SurName="kargfga" }, new MyClass{ ID =5, Name ="Maradona", SurName="kagdgra" } }; List<TargetClass> li2 = new List<TargetClass>() { new TargetClass{ TID=101, ID=1, Adress="fff", Zip="222"}, new TargetClass{ TID=102, ID=2, Adress="afff", Zip="222"}, new TargetClass{ TID=103, ID=2, Adress="bfff", Zip="222"}, new TargetClass{ TID=104, ID=2, Adress="cfff", Zip="222"}, new TargetClass{ TID=105, ID=3, Adress="dfff", Zip="222"}, new TargetClass{ TID=106, ID=3, Adress="efff", Zip="222"}, new TargetClass{ TID=107, ID=3, Adress="ffff", Zip="222"}, new TargetClass{ TID=108, ID=2, Adress="hfff", Zip="222"}, new TargetClass{ TID=109, ID=4, Adress="jfff", Zip="222"}, new TargetClass{ TID=110, ID=5, Adress="kfff", Zip="222"}}; } } public class MyClass { public int ID { get; set; } public String Name { get; set; } public String SurName { get; set; } } public class TargetClass { public int TID { get; set; } public int ID { get; set; } public String Adress { get; set; } public String Zip { get; set; } } }