Пример #1
0
 public void InsertAt(int j, GraduateStudet gs)
 {
     if (ListOfStudents[j] != null)
     {
         ListOfStudents.Insert(j - 1, gs);
         GraduateStudentInserted?.Invoke(this, new GraduateStudentListHandlerEventArgs("ListOfStudents",
                                                                                       $"element was inserted to the {j - 1} posittion of the list", j - 1));
     }
     else
     {
         ListOfStudents.Add(gs);
         GraduateStudentAdded?.Invoke(this, new GraduateStudentListHandlerEventArgs("ListOfStudents",
                                                                                    "element was added to the end of the list", ListOfStudents.Count));
     }
 }
Пример #2
0
        public void AddDefaults()
        {
            /*c допомогою якого можна додати деяке число елементів
             * типу GraduateStudent для ініціалізації колекції за замовчуванням; */
            int sizedef = 7;

            GraduateStudet[] p = new GraduateStudet[sizedef];
            for (int i = 0; i < sizedef; i++)
            {
                GraduateStudet grd = new GraduateStudet();
                grd.LastName = grd.LastName + i;
                p[i]         = grd;
            }
            ListOfStudents.AddRange(p);
            GraduateStudentAdded?.Invoke(this, new GraduateStudentListHandlerEventArgs("ListOfStudents",
                                                                                       "element was added to the end of the list", ListOfStudents.Count));
        }
Пример #3
0
 public void AddGraduateStudents(params GraduateStudet[] p)
 {
     ListOfStudents.AddRange(p);
     GraduateStudentAdded?.Invoke(this, new GraduateStudentListHandlerEventArgs("ListOfStudents",
                                                                                "element was added to the end of the list", ListOfStudents.Count));
 }