Exemplo n.º 1
0
        static void GetOrderedCars()
        {
            var query = from c in Gibdd.GetCars()
                        orderby c.Body
                        select new { Name = c.Name, Body = c.Body };

            foreach (var q in query)
            {
                Console.WriteLine("{0} {1}", q.Name, q.Body);
            }
        }
Exemplo n.º 2
0
        static void GetCarsByBody(string name)
        {
            var query = from c in Gibdd.GetCars()
                        let carBody = c.Body.ToLower()
                                      where carBody == name.ToLower()
                                      select c.Name;

            foreach (var q in query)
            {
                Console.WriteLine("{0}", q);
            }
        }