public class MainClassToSortEmployee
{
public enum SortDirection { Ascending, Decending }
public static List
Func
{
if (direction == SortDirection.Ascending)
return list = list.OrderBy(sorter).ToList();
else
return list = list.OrderByDescending(sorter).ToList();
}
static void Main()
{
}
}
public class Employee
{
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime dateTime { get; set; }
public Employee(string p, string p_2, DateTime dateTime)
{
this.FirstName = p;
this.LastName = p_2;
this.dateTime = dateTime;
}
}
next task is to convert it to a Generic Linq
No comments:
Post a Comment