Match the IValueComparer interface to the IValueRetriever interface
CanCompare method of the
IValueComparer interface only has the
actualValue parameter. It would be useful to extend this with the same parameters as the
IValueRetriever. And the same for the
I've come across situations where different values are converted to the same type like an
integer. For example distance and temperature as shown in the sample below.
Given the following table | Distance | Temperature | | 1 meter | 20 °C | | 2 millimeter | -7 °C |
For the value retriever we can check the cell value to see if it's a distance value or temperature and use different value retrievers to convert distance or temperature.
For the value comparer we can only check the actual value inside
CanCompare, which is in both cases an
integer. This means that we'll have to build 1 value comparer that compares distance, temperature and all other integers (because the custom value retriever superseeds the default value comparer).
By adding the other arguments to the
IValueComparer interface, we can separate the value comparers and create better maintainable code.
Please sign in to leave a comment.