12
Answers

Intersection for Two List problem

Sin Yee

Sin Yee

13y
4k
1
Hi...i am trying doing the intersection between two List. but, i tried many times still cannot get it. Hope someone can help me...

Here is the coding.
 List<KeyValuePair<String, int>> L = new List<KeyValuePair<String, int>>(sItem.ToList());
                       L.Reverse();
                       L.Sort(delegate(KeyValuePair<String, int> lhs, KeyValuePair<String, int> rhs)
                       { return rhs.Value.CompareTo(lhs.Value); });
                     
                       foreach (KeyValuePair<String,int> val in L)
                       {
                           show3 += val.Key+"\r\n";
                       }
                       MessageBox.Show(show3.ToString());


                       List<KeyValuePair<String, int>> P = new List<KeyValuePair<String, int>>(itemS.ToList());
                       foreach (KeyValuePair<String, int> pair in P)
                       {
                           show4 += pair.Key+"\r\n";
                       }
                       MessageBox.Show(show4.ToString()); 


Answers (12)