Hi,

if there are two objects of type SortedList, how can I compare them?
i wan use intersect method and hash function to count how many times the Keys are duplicate.
My program is in window form, not console.

What hash funstion do you mean? There is no operation with this name in Lambda Expressions. But here is an example with Intersept operator:

SortedList<int, int> s1 = new SortedList<int, int>();
            for (int i = 0; i < 10; i++)
                s1.Add(i, i); //ADDED: 0,1,2,3,4,5,6,7,8,9
            SortedList<int, int> s2 = new SortedList<int, int>();
            for (int i = 0; i < 10; i++)
                s2.Add(i * 2, i * 2);//ADDED: 0,2,4,6,8,10,12,14,16,18,20

            var s3 = s1.Intersect(s2).ToList().Count; //RESULT IS 5 - only number(of keys 0,2,4,6,8)

Hope it helps,
Mitja