// реализация интерфейса IComparable public int CompareTo(object obj) { Worker_basic worker = obj as Worker_basic; int result = 0; if (Age < worker.GetAge) { result = -1; } else if (Age > worker.GetAge) { result = 1; } else { if (Salary < worker.CalcSalary()) { result = -1; } else if (Salary > worker.CalcSalary()) { result = 1; } else { result = 0; } } return(result); }
// Добавление работника в компанию public void Add(Worker_basic wb) { if (Count < List.Length) { List[Count] = wb; Count++; } else { Console.WriteLine($"{Count} < {List.Length}"); } }