Sin Yee

Sin Yee

  • NA
  • 145
  • 74.9k

Intersection for Two List problem

Mar 30 2011 6:07 AM
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)