Example #1
0
        static void Foo2()
        {
            var rep = PersonalRepository.Getinstance();

            foreach (var item in rep.GetAll())
            {
                Console.WriteLine($"{item.Name} {item.Age} {item.Surname}");
            }
        }
Example #2
0
        public static PersonalRepository Getinstance()
        {
            if (_instance == null)
            {
                _instance = new PersonalRepository();
            }

            return(_instance);
        }
Example #3
0
        static void Foo1()
        {
            var rep = PersonalRepository.Getinstance();

            rep.Add(new Person {
                Name = "Name", Age = 18, Surname = "Surname"
            });
            rep.Add(new Person {
                Name = "Name2", Age = 20, Surname = "Surname2"
            });
        }