Exemple #1
0
        public void NhapTuFile()
        {
            string       path = @"data.csv";
            StreamReader sr   = new StreamReader(path);
            string       str  = "";

            while ((str = sr.ReadLine()) != null)
            {
                // CPU,Intel,300 * CPU,Intel,300 * RAM,SamSung,50 * HDD,Seagate,500
                MayTinh  m = new MayTinh();
                string[] s = str.Split('*');
                foreach (string item in s)
                {
                    if (item.IndexOf("CPU") == 0)
                    {
                        m.Them(new CPU(item));
                    }
                    if (item.IndexOf("RAM") == 0)
                    {
                        m.Them(new Ram(item));
                    }
                }
                Them(m);
            }
        }
Exemple #2
0
 public void Them(MayTinh mt)
 {
     collection.Add(mt);
 }