Advertisement
svetlyoek

Untitled

Jun 10th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Repository
  4. {
  5. public class StartUp
  6. {
  7. public static void Main()
  8. {
  9. var repository = new Repository();
  10.  
  11. repository.Add(new Person("George", 10, new DateTime(2009, 05, 04)));
  12. repository.Add(new Person("Peter", 5, new DateTime(2014, 05, 24)));
  13.  
  14. Person foundPerson = repository.Get(0);
  15. Console.WriteLine($"{foundPerson.Name} is {foundPerson.Age} years old ({foundPerson.BirthDate:dd/MM/yyyy})");
  16.  
  17. Person newPerson = new Person("John", 12, new DateTime(2007, 2, 3));
  18. repository.Update(2, newPerson);
  19. repository.Update(0, newPerson);
  20.  
  21. foundPerson = repository.Get(0);
  22. Console.WriteLine($"{foundPerson.Name} is {foundPerson.Age} years old ({foundPerson.BirthDate:dd/MM/yyyy})");
  23. Console.WriteLine(repository.Count);
  24. repository.Delete(5);
  25. repository.Delete(0);
  26. Console.WriteLine(repository.Count);
  27.  
  28.  
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement