I have a long line with an OrderBy inside. This line repeats itself several times with only a minor difference:
OrderBy(m => m.Name)
OrderBy(m => m.CreationTime)
etc.
In the interest of maintainability, is there a way to make only one line, and have it call some method, or perhaps use some Action that will take care of returning the correct field? The problem is that the fields are not of the same type.
Maybe this comes closer to what you want
Sorting would occur like this
Yet another way is to return a delegate