private void FindDifferences() { var originalSlidesIds = OriginalCourse.Slides.Select(s => s.Id).ToImmutableHashSet(); var changedSlidesIds = ChangedCourse.Slides.Select(s => s.Id).ToImmutableHashSet(); foreach (var slide in OriginalCourse.Slides) { if (!changedSlidesIds.Contains(slide.Id)) RemovedSlides.Add(slide); else { var slideDiff = new SlideDiff(slide, ChangedCourse.GetSlideById(slide.Id)); if (!slideDiff.IsEmptyChangeset) SlideDiffs.Add(slideDiff); } } InsertedSlides.AddRange(ChangedCourse.Slides.Where(slide => !originalSlidesIds.Contains(slide.Id))); }
private void FindDifferences() { var originalSlidesIds = OriginalCourse.Slides.Select(s => s.Id).ToImmutableHashSet(); var changedSlidesIds = ChangedCourse.Slides.Select(s => s.Id).ToImmutableHashSet(); foreach (var slide in OriginalCourse.Slides) { if (!changedSlidesIds.Contains(slide.Id)) { RemovedSlides.Add(slide); } else { var slideDiff = new SlideDiff(slide, ChangedCourse.GetSlideById(slide.Id)); if (!slideDiff.IsEmptyChangeset) { SlideDiffs.Add(slideDiff); } } } InsertedSlides.AddRange(ChangedCourse.Slides.Where(slide => !originalSlidesIds.Contains(slide.Id))); }