Student { First { ; ; } Last {; ;} ID { ; ; } Street { ; ; } City { ; ; } List<> Scores; } Teacher { First { ; ; } Last { ; ; } ID { ; ; } City { ; ; } }
DataTransformations { Main() { List<Student> students = List<Student>() { Student {First=, Last=, ID=111, Street=, City=, Scores= List<> {97, 92, 81, 60}}, Student {First=, Last=, ID=112, Street=, City=, Scores= List<> {75, 84, 91, 39}}, Student {First=, Last=, ID=113, Street=, City=, Scores= List<> {88, 94, 65, 91}}, }; List<Teacher> teachers = List<Teacher>() { Teacher {First=, Last=, ID=945, City = }, Teacher {First=, Last=, ID=956, City = }, Teacher {First=, Last=, ID=972, City = } }; peopleInSeattle = ( student students student.City == student.Last) .Concat( teacher teachers teacher.City == teacher.Last); Console.WriteLine(); ( person peopleInSeattle) { Console.WriteLine(person); } Console.WriteLine(); Console.ReadKey(); } }
XMLTransform { Main() { List<Student> students = List<Student>() { Student {First=, Last=, ID=111, Scores = List<>{97, 92, 81, 60}}, Student {First=, Last=, ID=112, Scores = List<>{75, 84, 91, 39}}, Student {First=, Last=, ID=113, Scores = List<>{88, 94, 65, 91}}, }; studentsToXML = XElement(, student students x = String.Format(, student.Scores[0], student.Scores[1], student.Scores[2], student.Scores[3]) XElement(, XElement(, student.First), XElement(, student.Last), XElement(, x) ) ); Console.WriteLine(studentsToXML); Console.WriteLine(); Console.ReadKey(); } }
FormatQuery { Main() { [] radii = { 1, 2, 3 }; IEnumerable<> query = rad radii String.Format(, (rad * rad) * 3.14); ( s query) Console.WriteLine(s); Console.WriteLine(); Console.ReadKey(); } }