Exemplo n.º 1
0
        public int Compare(Employee x, Employee y)
        {
            int             result = 0;
            SortingEmployes sort   = SortingEmployes1;

            if (sort == SortingEmployes.SortByAge)
            {
                if (x != null && y != null)
                {
                    result = x.Age.CompareTo(y.Age);
                }
            }
            else if (sort == SortingEmployes.SortByName)
            {
                if (x != null && y != null)
                {
                    result = String.Compare(x.Name, y.Name, StringComparison.Ordinal);
                }
            }
            else
            {
                if (sort == SortingEmployes.SortBySalary)
                {
                    if (x != null && y != null)
                    {
                        result = x.Salary.CompareTo(y.Salary);
                    }
                }
            }

            return(result);
        }
Exemplo n.º 2
0
 public Employee(SortingEmployes st)
 {
     SortingEmployes1 = st;
 }