There is a rather pretty solution how to get all the items from one generic collection (List<T>) which are not presented in the second one.

You can use simply the syntax like this:

   IEnumerable<MyFile> res = list1.Except(list2);

 

In the example below I wanted to get the list of different files in two directories. This code returns filenames from the directory "dir1" which are not presented in "dir2".

            string dir1 = @"C:\DataFolder\Foto\XonyXperia\";
            string dir2 = @"C:\DataFolder\Foto\2014 Spain\";
            List<MyFile> list1 = selectFiles(dir1);
            List<MyFile> list2 = selectFiles(dir2);
            IEnumerable<MyFile> res = list1.Except(list2);
            myDataGrid.ItemsSource = res;