Esempio n. 1
0
        static void Main(string[] args)
        {
            StringBuilder locatie = new StringBuilder();

            Console.WriteLine("Wat is de locatie van het bestandje?");
            locatie.Append(Console.ReadLine());
            Console.WriteLine("Welk tekstbestandje wil je gebruiken?");
            locatie.Append(@"\" + Console.ReadLine());

            InwonerFactory factory = new InwonerFactory();

            try
            {
                string regel;
                Eiland eiland = new Eiland();
                using (var lezer = new StreamReader(locatie.ToString()))
                {
                    while ((regel = lezer.ReadLine()) != null)
                    {
                        IInwoner inwoner = factory.GetSoortInwoner(regel.Substring(0, 1).ToString());
                        inwoner.Naam = regel.Substring(regel.IndexOf("=") + 1);
                        eiland.Add(inwoner);
                    }
                }
                Console.WriteLine();
                eiland.GetReacties();
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 2
0
 public void Add(IInwoner inwoner)
 {
     Inwoners.Add(inwoner);
 }