Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }