Sort uses the IComparable interface, if the type implements it. And you can avoid the ifs by implementing a custom IComparer:
class EmpComp : IComparer<Employee>
{
string fieldName;
public EmpComp(string fieldName)
{
this.fieldName = fieldName;
}
public int Compare(Employee x, Employee y)
{
// compare x.fieldName and y.fieldName
}
}
and then
list.Sort(new EmpComp(sortBy));