Thanks guys. It worked. I just want to add.
The types of these columns should implement non-generic IComparable
, which is usually not a problem if you use primitive or .net types. But if you have your own types, then you have to add them.
eg.
public struct Distance : ..., IComparable, IComparable<Distance>, ... { ... public int CompareTo(object obj) { if (obj == null) { return 1; } if (obj.GetType() != typeof(Distance)) { return 0; } return CompareTo((Distance)obj); } public int CompareTo(Distance other) { return _meters.CompareTo(other._meters); } }
source share