I made a simple multi join code in c#-LINQ.
But some problem happen like this.
sample 1) It is well work. The result is [1, 2].
public class tempClass1
    {
        public int i1;
        public int i2;
    }
    public class tempClass2
    {
        public int i3;
        public int i4;
    }
    public class CompareClass
    {
        public int compare1;
        public int compare2;
    }
    List<tempClass1> tempList1 = new List<tempClass1>();
    List<tempClass2> tempList2 = new List<tempClass2>();
    public MainWindow()
    {
        InitializeComponent();            
        try
        {
            tempList1.Add(new tempClass1() { i1 = 1, i2 = 2 });
            tempList1.Add(new tempClass1() { i1 = 3, i2 = 4 });
            tempList1.Add(new tempClass1() { i1 = 5, i2 = 6 });
            tempList2.Add(new tempClass2() { i3 = 1, i4 = 2 });
            var result = from t1 in tempList1
                         join t2 in tempList2 on
                         new { compare1 = t1.i1, compare2 = t1.i2 } equals
                         new { compare1 = t2.i3, compare2 = t2.i4 }
                         select t1;
        }
        catch(Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
    }
sample 2) It is not working compare code. The result is empty.
public class tempClass1
    {
        public int i1;
        public int i2;
    }
    public class tempClass2
    {
        public int i3;
        public int i4;
    }
    public class CompareClass
    {
        public int compare1;
        public int compare2;
    }
    List<tempClass1> tempList1 = new List<tempClass1>();
    List<tempClass2> tempList2 = new List<tempClass2>();
    public MainWindow()
    {
        InitializeComponent();            
        try
        {
            tempList1.Add(new tempClass1() { i1 = 1, i2 = 2 });
            tempList1.Add(new tempClass1() { i1 = 3, i2 = 4 });
            tempList1.Add(new tempClass1() { i1 = 5, i2 = 6 });
            tempList2.Add(new tempClass2() { i3 = 1, i4 = 2 });
            var result = from t1 in tempList1
                         join t2 in tempList2 on
                         new CompareClass { compare1 = t1.i1, compare2 = t1.i2 } equals
                         new CompareClass { compare1 = t2.i3, compare2 = t2.i4 }
                         select t1;
        }
        catch(Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
I don't know what is different these codes. Please tell me some guide line or feedback.
 
     
     
    