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

namespace Lambda04
{
    public class Program
    {
        //Func-Delegate
        static Func<string, bool> filter = s => s.Length == 5;
        static Func<string, string> extract = s => s;
        static Func<string, string> project = s => s.ToUpper();

        /*Anonyme Methoden
        static Func<string, bool> filter = delegate(string s)
        {
            return s.Length == 5;
        };
        static Func<string, string> extract = delegate(string s)
        {
            return s;
        };
        static Func<string, string> project = delegate(string s)
        {
            return s.ToUpper();
        };
        */

        public static void Main(string[] args)
        {
            List<string> customers = new List<string>();
            customers.Add("Shinja");
            customers.Add("Aaron");
            customers.Add("Angela");
            customers.Add("Dirk");

            if (filter(customers[1]))
                Console.WriteLine(customers[1].Length.ToString());

            Console.WriteLine(extract(customers[0]));

            Console.WriteLine(project(customers[2]));

            Console.ReadLine();
        }
    }
}