static void Main(string[] args) { var employees = GetData(); //MyDelegate del = new MyDelegate(Bedingung); //Func<Employee, bool> del = new Func<Employee, bool>(Bedingung); //var del = new Func<Employee, bool>(Bedingung); //Func<Employee, bool> del = Bedingung; //var query = Abfrage(employees, del); //var query = Abfrage(employees, Bedingung); //var query = Abfrage(employees, delegate(Employee e) //{ // return e.Experience == 5; //}); //var query = Abfrage(employees, (Employee e) => //{ // return e.Experience > 5; //}); //var query = Abfrage(employees, (e) => //{ // return e.Experience > 5; //}); //var query = MyExtentions.Abfrage(employees, e => e.Experience > 5); var query = employees.Abfrage(e => e.Name.Contains("m")); var linqQuery = employees .Where(e => e.Experience > 5) .OrderBy(e => e.Name); var y = from e in employees where e.Experience > 5 orderby e.Name select e; var namen = new[] { "Sepp", "Lukas", "Klaus" }; var x = MyExtentions.Abfrage(namen, n => n.StartsWith("L")); foreach (var e in query) { Console.WriteLine($"Id: {e.Id} - {e.Name,10} - {e.Experience,2}"); } var i = 4; i.Dump(); "Hy".Dump(); 8.Dump(); true.Dump(); false.Dump(); employees.Dump(); namen.Dump(); Console.ReadKey(); }
static void Main(string[] args) { var employees = GetData(); //MyDelegate del = new MyDelegate(Bedingung); //Func<Employee, bool> del = new Func<Employee, bool>(Bedingung); //var del = new Func<Employee, bool>(Bedingung); //Func<Employee, bool> del = Bedingung; //var query = Abfrage(employees, del); //var query = Abfrage(employees, Bedingung); //var query = Abfrage(employees, delegate(Employee e) //{ // return e.Experience > 10; //}); //var query = Abfrage(employees, (Employee e) => //{ // return e.Experience > 10; //}); //var query = Abfrage(employees, (e) => //{ // return e.Experience > 10; //}); //var query = Abfrage(employees, (e) => e.Experience > 10); var query = MyExtentions.Abfrage(employees, e => e.Experience > 10); var linqQuery = employees.Where(e => e.Name.Contains("T")); query = employees.Abfrage(e => e.Experience < 10); Func <Employee, bool> del = new Func <Employee, bool>(Bedingung); var linqQuery2 = employees.Where(del); var namen = new [] { "Sepp", "Franz", "Lisa" }; var gefiltert = MyExtentions.Abfrage(namen, n => n.Length < 5); gefiltert = namen.Abfrage(n => n.Length > 5); foreach (var e in query) { //Console.WriteLine("{0} - {1,20} - {2}", e.Id, e.Name, e.Experience); // String Interpolation (ab VS2015 / C#6) Console.WriteLine($"{e.Id} - {e.Name, 15} - {e.Experience}"); } Console.ReadLine(); }
static void Main(string[] args) { var employees = GetData(); //MyDelegate del = new MyDelegate(Bedingung); //Func<Employee, bool> del = new Func<Employee, bool>(Bedingung); //var del = new Func<Employee, bool>(Bedingung); //Func<Employee, bool> del = Bedingung; //var query = Abfrage(employees, del); //var query = Abfrage(employees, Bedingung); //var query = Abfrage(employees, delegate (Employee e) //{ // return e.Experience < 5; //}); //var query = Abfrage(employees, (Employee e) => //{ // return e.Experience < 5; //}); //var query = Abfrage(employees, (e) => //{ // return e.Experience < 5; //}); //var query = Abfrage(employees, (e) => e.Experience < 5 || e.Experience > 10); var query = MyExtentions.Abfrage(employees, e => e.Experience < 5); var query2 = employees.Abfrage(e => e.Experience > 5); var linq = employees.Where(Bedingung); var linq2 = employees.Where(e => e.Experience > 5); foreach (var e in query) { Console.WriteLine($"Id: {e.Id} - {e.Name,10} - {e.Experience}"); } Console.ReadKey(); }