static void Main(string[] args) { Pupil élève = new Pupil("Chris",6); Activity act1 = new Activity("Math",true); Activity act2 = new Activity("Français", true); Activity act3 = new Activity("Sciences", true); Activity act4 = new Activity("Religion", false); élève.AddActivity(act1); élève.AddActivity(act2); élève.AddActivity(act3); élève.AddActivity(act4); élève.AddEvaluation("Math"); //System.Console.Write(élève); //System.Console.Write(élève.PrintPupilActivityCompulsory (delegate(Activity activity) {return activity.Title+"\n";}) ); //System.Console.Write(élève.PrintPupilActivityCompulsory(PrintActivity)); PrintActivityDelegate p = new PrintActivityDelegate(); System.Console.Write(élève.PrintPupilActivityCompulsory(p.PrintActivity)); System.Console.Read(); /*List<Pupil> LstEleves = new List<Pupil>() { new Pupil("Chris",6), new Pupil("Jean",7,2), new Pupil("John",8,3), new Pupil("Jack",7), new Pupil("Jojo",7,2), new Pupil("Jeff",8) };*/ /*var pupilGrade1Plus6 = from pupil in LstEleves where pupil.Grade == 1 && pupil.Age > 6 select pupil;*/ /*var pupilGrade1Plus6 = LstEleves.Where(pupil => pupil.Grade == 1 && pupil.Age > 6); if (pupilGrade1Plus6 != null) { foreach (var élève in pupilGrade1Plus6) { System.Console.Write(élève); System.Console.Write("\n"); } } System.Console.Read();*/ /*List<Pupil> listPupils = new List<Pupil>() { new Pupil("Chris",6), new Pupil("Jean",7,2), new Pupil("John",8,3), new Pupil("Jack",7), new Pupil("Jojo",7,2), new Pupil("Jeff",8) }; List<Person> listPersons = new List<Person>() { new Person("Christian",46), new Person("Jean-Noel",47), new Person("Johnson",48) }; var listFusion = listPersons.Union(listPupils); foreach (var pers in listFusion) { System.Console.Write(pers); System.Console.Write("\n"); } System.Console.Read();*/ /*List<Pupil> listPupilsDuplicated = new List<Pupil>() { new Pupil("Chris",6), new Pupil("Chris",6), new Pupil("Jack",7), new Pupil("Jack",7) }; IEnumerable<Pupil> listPupilsNoDuplicated = listPupilsDuplicated.Distinct<Pupil>(new PersonComparer()); System.Console.Write(listPupilsNoDuplicated.Count()); System.Console.Read();*/ }
static void Main(string[] args) { //Pupil p = new Pupil("Aurelien", 18, 3); //Activity a1 = new Activity("math", true); //Activity a2 = new Activity("anglais", false); //Activity a3 = new Activity("francais", true); //p.AddActivity(a1); //p.AddActivity(a2); //p.AddActivity(a3); //p.AddEvaluation(a1.Title); //p.AddEvaluation(evaluation: 'T', title: "anglais"); //p.AddEvaluation("francais", 'R'); //List<Pupil> pupils = new List<Pupil>() { // new Pupil("quentin", 12, 5), // new Pupil("kevin", 7 , 1), // new Pupil("maxime", 3, 2) //}; //var pupilGrade1Plus6 = from pupil in pupils // where pupil.Grade == 1 && pupil.Age > 6 // select pupil; //List<Pupil> pupils = new List<Pupil>(); //pupils.Add(new Pupil("kevin", 7, 1)); //pupils.Add(new Pupil("cedric", 5, 2)); //pupils.Add(new Pupil("quentin", 8, 4)); //var pupilGrade1Plus6 = pupils.FindAll(p => p.Grade == 1); //Console.Write(p); //if (pupilGrade1Plus6 != null) //{ // foreach (var pupil in pupilGrade1Plus6) // { // Console.Write(pupil); // } //} //else //{ // Console.Write("test"); //} //List<Pupil> listPupils = new List<Pupil>() { // new Pupil("quentin", 12, 4), // new Pupil("kevin", 7 , 1), // new Pupil("maxime", 3, 7) //}; //List<Person> listPersons = new List<Person>() { // new Person("azeaze", 12), // new Person("azerr", 7 ), // new Person("ffdfsdf", 3) //}; //var listFusion = listPersons.Union(listPupils); //foreach (var item in listFusion) //{ // Console.Write(item); //} //List<Pupil> listPupilsDuplicated = new List<Pupil>() { // new Pupil("quentin", 12, 4), // new Pupil("kevin", 7 , 1), // new Pupil("maxime", 3, 7), // new Pupil("quentin", 12, 4), // new Pupil("kevin", 7 , 1), // new Pupil("maxime", 3, 7) //}; //IEnumerable<Pupil> listPupilsNoDuplicated = listPupilsDuplicated.Distinct<Pupil>(new PersonComparer()); //Console.Write(listPupilsNoDuplicated.Count()); //===LABO 2 Pupil pupilActComp = new Pupil("quentin", 18); Activity a1 = new Activity("math", true); Activity a2 = new Activity("anglais", false); Activity a3 = new Activity("francais", true); pupilActComp.AddActivity(a1); pupilActComp.AddActivity(a2); pupilActComp.AddActivity(a3); //Console.WriteLine(pupilActComp.PrintPupilActivityCompulsory( // delegate(Activity activity) // { // return activity.Title + "\n"; // })); //Console.WriteLine(pupilActComp.PrintPupilActivityCompulsory(PrintActivity)); PrintActivityDelegate p = new PrintActivityDelegate(); Console.WriteLine(pupilActComp.PrintPupilActivityCompulsory(p.PrintActivity)); Object obj = 10; obj = (int)obj + 10; Console.WriteLine(obj); Console.Read(); }