Exemple #1
0
 static void Main(string[] args)
 {
     Student Student1 = new Student("Sashko", "Nakonechnyi", DateTime.Now, Education.Specialist, 23, 2);
     Console.WriteLine(Student1.ToShortString());
     Console.WriteLine();
     Student1.date = DateTime.Now;
     Student1.groupNum = 199;
     Student1.Date = DateTime.Now;
     Exam[] ex = new Exam[2];
     ex[0] = new Exam("Maths", 5, DateTime.Now);
     ex[1] = new Exam("English", 4, DateTime.Now);
     Student1.AddExams(ex);
     Console.WriteLine(Student1.ToString());
     Console.WriteLine();
     Person p1 = new Person("X", "T", DateTime.Now);
     Person p2 = new Person("X", "T", DateTime.Now);
     Console.WriteLine(p1.Equals(p2));
     Console.WriteLine(p1.GetHashCode());
     Console.WriteLine(p2.GetHashCode());
     Console.WriteLine();
     Student Student2 = new Student("Ivan", "Ivanov", DateTime.Now, Education.Bachelor, 200, 2);
     Student2.AddExams(new Exam("Inforamatics", 3, DateTime.Now), new Exam(), new Exam("OOP",5,DateTime.Now));
     Student2.AddTests(new Test("Physics", true), new Test("Economics", false));
     Console.WriteLine(Student2.ToString());
     Console.WriteLine();
     Console.WriteLine(Student2.person.ToString());
     Console.WriteLine();
     Student Student3 = (Student) Student2.DeepCopy();
     Student2.name = "Sashko";
     Console.WriteLine(Student2.ToShortString());
     Console.WriteLine(Student3.ToShortString());
     Console.WriteLine();
     try
     {
         Student1.groupNum=99;
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
     Console.WriteLine();
     foreach(Exam E in Student2.exams)
         Console.WriteLine(E.ToString());
     foreach (Test T in Student2.testList)
         Console.WriteLine(T.ToString());
     Console.WriteLine();
     foreach (Exam e in Student3.exams)
         if (e.Mark > 3)
             Console.WriteLine(e.ToString());
 }
Exemple #2
0
        static int Main()
        {
            List<person> p = new List<person>();
            var names = new[] {"Bessie","Vashti","Fredrica","Nisha","Kendall","Magdalena","Brendon","EVe","Manda","Elvera","Miquel",
                                 "Tyra","Lucie","Marvalla","Tracee","Ramiro","Irene","Davina","Jeromy","Siu"};
            int i;
            for (i = 0; i < names.Length; i++)
                p.Add(new person(names[i]));
            foreach (var value in p)
                Console.WriteLine(Value);
            List<person>q = new List<person>();
            var stringlist = new[]{"Bessie","Vashti","Fredrica","Nisha","Kendall","Magdalena","Brendon","Eve","Manda","Elvera","Miquel",
                                    "Tyra","Luice","Marvalla","Tracee","Ramiro","Irene","Davina","Jeromy","Siu"};

            var People = new Person[20];
               for(i=0; i<stringlist.Length;i++)
                   new Person(stringlist[i]);
            var Name = from n in People
                        where stringlist[0].StartsWith("M")
                        //orderby n ascending
                        select n;
            foreach (var member in Name)
                Console.WriteLine("Name:{0}", member);
               return 0;

               List<person> li = new List<person>();
               var nameslist = new[] {"Bessie","Vashti","Fredrica","Nisha","Kendall","Magdalena","Brendon","Eve","Manda","Elvera","Miquel",
                                   "Tyra","Luice","Marvalla","Tracee","Ramiro","Irene","Davina","Jeromy","Siu"};
               for (i = 0; i < nameslist.Length; i++)
               li.Add(nameslist[i]);
                    var result = li.Select(m=>m.ToUpper());
            foreach(var item in result)
                Console.WriteLine(item);
            Console.ReadLine();

            List<person> r = new List<person>();
            var stringlist = new[]{"Bessie","Vashti","Fredrica","Nisha","Kendall","Magdalena","Brendon","Eve","Manda","Elvera","Miquel",
                                     "Tyra","Luice","Marvalla","Tracee","Ramiro","Irene","Jeromy","Davina","Siu"};
            var People = new Person[20];
            for (i = 0; i < stringlist.Length; i++)
                new Person(stringlist[i]);
            var Name = from in People
                        where list[i].Substring(0,3)
                            //orderby n ascending
                        select n;
            foreach(var member in Name)
                Console.WriteLine("Name:{0}", member);
            return 0;
        }
Exemple #3
0
        private static void RepositoryTests(IRepository<Person> personRepo, Action commitChanges)
        {
            Console.WriteLine("Testing with '{0}' ", personRepo);

            var id = Guid.NewGuid();
            var person = new Person {
                Id = id,
                Name = id.ToString()
            };

            personRepo.Add(person);

            // Commit the changes depending on the provider
            commitChanges();

            var found = personRepo.Where(p => p.Id == id)
                .FirstOrDefault();

            Console.Write(found.Name);
        }
 partial void DeletePerson(Person instance);
 partial void UpdatePerson(Person instance);
 partial void InsertPerson(Person instance);