Example #1
0
        // create and implement the personList method when the program runs.
        static void LoadPerson(List <Person> personList)
        {
            using StreamReader sr = new StreamReader("resource/Person.csv");
            string read = sr.ReadLine();

            while ((read = sr.ReadLine()) != null)
            {
                string[] body        = read.Split(",");
                string   name        = body[1];
                string   passportno  = body[4];
                string   nationality = body[5];
                Person   p           = new Vistor(name, passportno, nationality);
                personList.Add(p);
            }
        }
Example #2
0
        /* Create a vistor object */
        public static Vistor AddVistor(List <Vistor> vistorList)
        {
            Console.Write("Name of the indivual: ");
            string name = Console.ReadLine();

            Console.Write("Passport number: ");
            string pass = Console.ReadLine();

            Console.Write("Nationality: ");
            string nati = Console.ReadLine();
            Vistor vl   = new Vistor(name, pass, nati);

            vistorList.Add(vl);
            Console.WriteLine("New Vistor has been added to the list sucessfully.");
            return(vl);
        }