static void IndexFiltering() { var pass = Titanic.GetPassengers().Where((r, index) => r.Name.StartsWith("N") && index > 5); foreach (var r in pass) { Console.WriteLine("{0} {1}\n", r.Name, r.Ticket); } }
static void CompoundFrom() { var pass = from r in Titanic.GetPassengers() where r.Survival == true orderby r.Name select r.Name; foreach (var r in pass) { Console.WriteLine(r); } }
static void GetSurvived() { Console.WriteLine("Get Sutvived Passengers...\n"); var pass = from p in Titanic.GetPassengers() where p.Survival == true select p; foreach (var p in pass) { Console.WriteLine("{0} {1}\n", p.Name, p.Ticket); } }
static void GetLittleGirls() { Console.WriteLine("Get little girls...\n"); var pass = from p in Titanic.GetPassengers() where p.Age < 15 && p.Sex == " female " select p; foreach (var p in pass) { Console.WriteLine("{0} {1}\n", p.Name, p.Age); } }