public Boolean readData() { StreamReader rd; if (!File.Exists(fileName)) { FileStream fs = File.Create(fileName); rd = new StreamReader(fs, Encoding.UTF8); } else { rd = new StreamReader(this.fileName); } //String idMH, ma_HK, tenMH; //int soTC, lyThuyet, thucHanh; String idMH; idMH = rd.ReadLine(); while (idMH != null) { MonHoc mh = new MonHoc(); mh.SetIdMH(idMH); mh.SetMa_HK(rd.ReadLine()); mh.SetTenMH(rd.ReadLine()); mh.SetSoTC(Convert.ToInt32(rd.ReadLine())); mh.SetLyThuyet(Convert.ToInt32(rd.ReadLine())); mh.SetThucHanh(Convert.ToInt32(rd.ReadLine())); monHoc.Add(mh); idMH = rd.ReadLine(); } return(true); }