Imagine you need to build an algorithm to sort certain .NET object collection by any number of expressions. These expressions are provided by the caller as another collection of objects, describing sequence of properties and sorting directions:
The key to solving this issue is to build a linked list of Comparison<T> delegate wrappers. Each of these wrappers would compare objects and, if they are equal, call next Comparison<T> until it reaches the end of the chain.
This is the comparison liked list:
And this is how to use it:
The key to solving this issue is to build a linked list of Comparison<T> delegate wrappers. Each of these wrappers would compare objects and, if they are equal, call next Comparison<T> until it reaches the end of the chain.
This is the comparison liked list:
And this is how to use it:
Comments