using System; using System.Collections.Generic; using System.Data.Linq; using System.Linq; using System.Text; using System.Drawing; namespace AndmeProjekt { class AndmeUuring { public static void Tryki(IEnumerable m) { foreach (T element in m) { Console.WriteLine(element); } } static void Arvud1(){ int[] arvud = { 3, 7, 6 }; for (int i = 0; i < arvud.Length; i++) { Console.WriteLine(arvud[i]); } Tryki(arvud); } static void Arvud2() { LinkedList loetelu = new LinkedList(); loetelu.AddLast(7); loetelu.AddLast(9); loetelu.AddLast(5); Tryki(loetelu); } static void Tekstid1() { LinkedList loetelu = new LinkedList(); loetelu.AddLast("Kati"); loetelu.AddLast("Juku"); loetelu.AddLast("Mati"); Tryki(loetelu); } static void Punktid1() { Point[] pd = { new Point(1, 0), new Point(5, 4), new Point(3, 5) }; var tulemus = from p in pd where p.X > p.Y orderby p.Y select p; Tryki(tulemus); } static void Arvud3() { int[] arvud = { 2, 7, 8, 6, 5, 3, 4 }; //var tulemus = from a in arvud where a > 3 select a; IEnumerable tulemus = from a in arvud where a > 3 orderby a select a; Tryki(tulemus); } static void Tekstid2() { string[] tekstid = {"Kati", "Juku", "Mati"}; IEnumerable tulemus = from s in tekstid orderby s select s.Substring(0, 1); Tryki(tulemus); } static void Baasivalik() { DataContext db = new DataContext("E:\\baas1.mdf"); Table koordinaadid = db.GetTable(); var tulemus = from punkt in koordinaadid where punkt.x > 2 select punkt; Tryki(tulemus); } public static void Main(String[] arg) { Arvud3(); Punktid1(); } } }