C#, Linq2SQL: Creating a predicate to find elements within a number of ranges
问题 Lets say I have something called Stuff in my database, with a property called Id. From the user I get a sequence of selected Range objects (or rather I create them from their input) with the Ids they want. A stripped down version of that struct looks like this: public struct Range<T> : IEquatable<Range<T>>, IEqualityComparer<Range<T>> { public T A; public T B; public Range(T a, T b) { A = a; B = b; } ... } So one could for example have gotten: var selectedRange = new List<Range<int>> { new