static void Main() { int index; Student student; StudentList studentList1 = new StudentList(); StudentList studentList2; ConsoleApp.ClrScr(); IdentifyApplication(); OpenFiles(); studentList1.Fill(fileIn); studentList1.AppendReport(fileOut, "List One - ID Order"); studentList1.SelectionSort(Student.CompareNames); studentList1.AppendReport(fileOut, "List One - Name Order"); studentList1.SelectionSort(Student.CompareBirthDates); studentList1.AppendReport(fileOut, "List One - Birth Date Order"); studentList1.SelectionSort(Student.CompareMajors); studentList1.AppendReport(fileOut, "List One - Major Order"); studentList1.SelectionSort(Student.CompareHours); studentList1.AppendReport(fileOut, "List One - Hours Order"); studentList1.SelectionSort(Student.CompareGPAs); studentList1.AppendReport(fileOut, "List One - GPA Order"); studentList1.SelectionSort(Student.CompareNames); student = new Student(studentList1.AssignID(), "Rogers, Marshall", "January 31, 1994", "CI05", 115.5, 3.68); index = ~studentList1.BinarySearch(student, Student.CompareNames); studentList1.InsertAt(index, student); studentList1.AppendReport(fileOut, "List One - Name Order"); studentList2 = studentList1.Clone(); studentList1.Clear(); studentList2.RemoveAt(index); studentList1.AppendReport(fileOut, "List1 - Cleared"); studentList2.AppendReport(fileOut, "List Two - Name Order"); CloseFiles(); }
private void IncreaseCapacity() { StudentList tempList; tempList = new StudentList(2*this.capacity); foreach (Student student in this) tempList.Add(student); this.capacity = tempList.capacity; this.count = tempList.count; this.items = tempList.items; }
// Deep Copy method public void Copy(StudentList sourceList) { this.Clear(); foreach (Student student in sourceList) this.Add(student.Clone()); }
// Copy constructor public StudentList(StudentList sourceList) { this.Copy(sourceList); }