danturn 1 Light Poster

Hey guys,

I've got 2 collections (one datatable and one list of an object)

i need to compare them and get a collection of the matches and a collection of the items that dont match (from both collections)

i've got the matched collection sorted:

var yourNumbers = from DataRow yourNumber in yourNumberList.Rows
                               select new
                               {
                                   type = yourNumber["DDITYPEID"].ToString(),
                                   extension = yourNumber["EXTENSION"].ToString()
                               };

            var myNumbers = from myNumber in myNumberList
                              select new
                              {
                                  type = myNumber.type,
                                  extension = myNumber.number,
                                  key = myNumber.key
                              };

            var matchedNumbers = from vossNumber in vossNumbers
                                 join smartNumber in smartNumbers on vossNumber.extension equals smartNumber.extension
                                 select new
                                 {
                                     smartNumber.type,
                                     smartNumber.extension,
                                     vossNumber.key
                                 };

that works fine, but im struggling with the unmatched.

i've tried this:

var unmatchedNumbers =
                myNumbers.Except(myNumbers.Join(yourNumbers, myNumber => myNumber.extension,
                                                    yourNumber => yourNumber.extension,
                                                    (myNumber, yourNumber) => myNumber));

which returns items that are in the mynumber list only but not items that are only in the yournumber list.

any ideas?

dan