public void Delete(SV s) { for (int i = 0; i < siso; i++) { if (data[i].Maso == s.Maso && data[i].Tuoi == s.Tuoi && data[i].Gioitinh == s.Gioitinh) { for (int j = i + 1; j < siso; j++) { data[j - 1] = data[j]; } data[siso - 1] = null; siso--; } } }
static void Main() { Console.Write("Nhap so SV: "); int n = Convert.ToInt32(Console.ReadLine()); ListSV A = new ListSV(n); A.Add(new SV("123", 20, true)); A.Add(new SV("453", 23, true)); A.Add(new SV("232", 21, true)); A.Add(new SV("333", 25, false)); SV d = new SV("123", 20, true); A.Delete(d); Console.Write("Nhap MSSV can tim: "); string str = Console.ReadLine(); A.Edit(A.Find(str)); A.Show(); Console.ReadKey(); }