コード例 #1
0
        // SKAITO IS FAILO
        public static Butai ReadData()
        {
            Butai visiButai = new Butai(MaxButu);
            int   count     = 0;

            using (StreamReader reader = new StreamReader(@"Butai.csv"))
            {
                string line = null;
                while (null != (line = reader.ReadLine()))
                {
                    string[] values     = line.Split(';');
                    int      butoNr     = int.Parse(values[0]);
                    double   plotas     = double.Parse(values[1]);
                    int      kambariuSk = int.Parse(values[2]);
                    double   kaina      = double.Parse(values[3]);
                    string   telNr      = values[4];
                    visiButai.butuMasyvas[count++].ButoNr = butoNr;
                    VienasButas butas = new VienasButas(butoNr, plotas, kambariuSk, kaina, telNr);
                    visiButai.Prideti(butas);
                }
            }
            return(visiButai);

            for (int i = 0; i < count; i++)
            {
                Console.WriteLine(visiButai.butuMasyvas[count++].ButoNr);
            }
        }
コード例 #2
0
 public void Prideti(VienasButas butai)
 {
     butuMasyvas[butaiCount] = butai;
     butaiCount++;
 }