コード例 #1
0
 public void AddStudents(params Student[] students)
 {
     foreach (var student in students)
     {
         _students.Add(student);
         StudentCountChanged?.Invoke(student, new StudentListHandlerEventArgs(CollectionName, "Додано новий елемент", student));
     }
 }
コード例 #2
0
 public void AddDefaults(int n)
 {
     for (int i = 0; i < n; i++)
     {
         var student = new Student(new Person($"John {i}", "Nir", new DateTime(2000, 05, 15)),
                                   Education.SecondEducation, 220);
         _students.Add(student);
         StudentCountChanged?.Invoke(student, new StudentListHandlerEventArgs(CollectionName, "Додано елемент", student));
     }
 }
コード例 #3
0
 public bool Remove(int j)
 {
     if (j < 0 || j > _students.Count - 1)
     {
         return(false);
     }
     StudentCountChanged?.Invoke(_students[j], new StudentListHandlerEventArgs(CollectionName, "Елемент видалено", _students[j]));
     _students.RemoveAt(j);
     return(true);
 }
コード例 #4
0
        public bool Remove(int j)
        {
            var st     = Students?.ElementAtOrDefault(j);
            var result = st != null;

            if (result)
            {
                Students.RemoveAt(j);
                StudentCountChanged?.Invoke(this, new StudentListHandlerEventArgs(Name, "Remove student.", st));
            }

            return(result);
        }
コード例 #5
0
        public void AddStudents(params Student[] _students)
        {
            foreach (Student student in _students)
            {
                students.Add(student);
                StudentListHandlerEventArgs args = new StudentListHandlerEventArgs
                {
                    Name  = this.Name,
                    Info  = "Student added",
                    Index = students.Count - 1
                };

                StudentCountChanged?.Invoke(student, args);
            }
        }
コード例 #6
0
        public void AddDefaults()
        {
            Student st;

            if (Students == null)
            {
                Students = new List <Student>();
            }

            for (int i = 0; i < 5; i++)
            {
                st = TestCollections.CreateStudent(i);
                Students.Add(st);
                StudentCountChanged?.Invoke(this, new StudentListHandlerEventArgs(Name, "Add new student.", st));
            }
        }
コード例 #7
0
        public void AddDefaults(int n)
        {
            for (int i = 0; i < n; i++)
            {
                Student student = new Student();
                students.Add(student);

                StudentListHandlerEventArgs args = new StudentListHandlerEventArgs
                {
                    Name  = this.Name,
                    Info  = "Default student added",
                    Index = students.Count - 1
                };

                StudentCountChanged?.Invoke(student, args);
            }
        }
コード例 #8
0
        public bool Remove(int index)
        {
            if (index <= 0 || index > students.Count())
            {
                StudentListHandlerEventArgs args = new StudentListHandlerEventArgs
                {
                    Name  = this.Name,
                    Info  = "Student removed",
                    Index = index
                };

                StudentCountChanged?.Invoke(students[index], args);

                students.RemoveAt(index);
            }
            else
            {
                return(false);
            }

            return(true);
        }
コード例 #9
0
        public void AddStudents(params Student[] students)
        {
            if (students == null || students.Length < 1)
            {
                return;
            }

            if (Students == null)
            {
                Students = new List <Student>();
            }

            Student st;

            for (int i = 0; i < students.Length; i++)
            {
                st = students[i];
                if (st != null)
                {
                    Students.Add(st);
                    StudentCountChanged?.Invoke(this, new StudentListHandlerEventArgs(Name, "Add new student.", st));
                }
            }
        }