using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    internal class Program
    {
        struct Koordinatak
        {
            public int X { get; set; }
            public int Y { get; set; }
        }

        struct Betuk
        {
            public char X { get; set; }
            public char Y { get; set; }
        }
        static void Main(string[] args)
        {
            //Pelda1();
            //Pelda2();
            Pelda3();

            Console.ReadLine();
            

        }

        static void Pelda3()
        {
            var elemek = new List<Betuk>
            {
                new Betuk { X = 'x', Y = 'c' },
                new Betuk { X = 'b', Y = 'c' },
                new Betuk { X = 'h', Y = 'c' },
                new Betuk { X = 'g', Y = 'c' },

            };

            var eredmeny = from elem in elemek orderby elem.X ascending select elem.X;

            foreach (var item in eredmeny)
            {
                Console.WriteLine(item);
            }
        }

        static void Pelda2()
        {
            var elemek = new List<Koordinatak>
            {
                new Koordinatak { X = 1, Y = 2 },
                new Koordinatak { X = 2, Y = 3 },
                new Koordinatak { X = 5, Y = 3 },
                new Koordinatak { X = 6, Y = 3 },
                new Koordinatak { X = 10, Y = 0 },

            };

            var eredmeny = from elem in elemek select elem.X;
            var eredmeny2 = elemek.Select(item => item.X);
            foreach (var item in eredmeny)
            {
                Console.WriteLine(item);
            }

            foreach (var item in eredmeny2)
            {
                Console.WriteLine(item);
            }
        }
        static void Pelda1()
        {
            int[] szamok = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };


            var eredmeny = from szam in szamok
                           where (szam % 2) == 0
                           select szam;

            var eredmeny2 = szamok.Where(szam => szam % 2 == 0);

            foreach (var item in eredmeny2)
            {
                Console.WriteLine(item);
            }

            foreach (var item in eredmeny)
            {
                Console.WriteLine(item);
            }
        }
    }
}
