Accepted answer

Since ModType is nullable, it did not return what I was expecting. The code should be...

return seg => seg.ModType == Deleted &&
          seg.Line.Segments.Any(segs => segs.ID != seg.ID && 
          (segs.ModType != Deleted || segs.ModType == null));

Thanks to all those who replied and gave comments and suggestions!


Instead of Any(), use Where(), which will return you an IEnumerable object. Like Jon says, Any() returns a boolean.


I'd think it would be something like:

return s =>  from segment in s.Line.Segments 
             where segment.ModType == Deleted 
                && segment.Line.Segments.Any(segs => segs.ModType != Deleted)
             select segment

Related Query

More Query from same tag