I have a generic class which could use a generic OrderBy argument
the class is as follows
class abc<T> where T : myType
{
public abc(....., orderBy_Argument ){ ... }
void someMethod(arg1, arg2, bool afterSort = false)
{
IEnumerable<myType> res ;
if ( afterSort && orderBy_Argument != null )
res = src.Except(tgt).OrderBy( .... );
else
res = src.Except(tgt);
}
}
The orderBy could be of various types
e.g.
.OrderBy( person => person.FirstName )
.OrderBy( person => person.LastName )
.OrderBy( person => person.LastName, caseInsensitive etc )
The goal is to make the orderBy an argument rather than bake it in
any ideas ?