コード例 #1
0
        public HalloDelegate()
        {
            EinfacherDelegate meinDele           = EinfacheMethode; //meinDele.Invoke();
            Action            meinDeleAction     = EinfacheMethode;
            Action            meinDeleActionAno  = delegate() { Console.WriteLine("Hallo"); };
            Action            meinDeleActionAno2 = () => { Console.WriteLine("Hallo"); };
            Action            meinDeleActionAno3 = () => Console.WriteLine("Hallo");

            DelegateMitPara deleMitPara      = MethodeMitPara;
            Action <string> deleMitParaActio = MethodeMitPara;
            DelegateMitPara deleMitParaAno   = (string msg) => { Console.WriteLine(msg); };
            DelegateMitPara deleMitParaAno2  = (msg) => Console.WriteLine(msg);
            DelegateMitPara deleMitParaAno3  = x => Console.WriteLine(x);

            CalcDele calcDele = Minus;  //long res = calcDele.Invoke(4, 6);
            Func <int, int, long> calcFunc = Sum;
            CalcDele calcDeleAno           = (int x, int y) => { return(x * y); };
            CalcDele calcDeleAno2          = (x, y) => { return(x * y); };
            CalcDele calcDeleAno3          = (x, y) => x * y;

            List <string> texte = new List <string>();

            texte.Where(x => x.StartsWith("M"));
            texte.Where(Filter);
        }
コード例 #2
0
        public HalloDelegate()
        {
            EinfacherDelegate meinDele           = EinfacheMethode;
            Action            meinDeleAlsAction  = EinfacheMethode;
            Action            meinDeleAlsAction2 = () => { Console.WriteLine("Hallo"); };

            DeleMitPara     meinDeleMitPara          = MethodeMitPara;
            Action <string> meinDeleMitParaAlsAction = MethodeMitPara;
            DeleMitPara     meinDeleMitPara2         = x => Console.WriteLine(x);

            CalcDele meinCalc = Minus;
            long     rsult    = meinCalc.Invoke(4, 5);
            Func <int, int, long> calcFunc = Sum;
            CalcDele meinCalc2             = (x, y) => { return(x / y); };
            CalcDele meinCalc3             = (x, y) => x / y;

            List <string> texte = new List <string>();


            var result  = texte.Where(Filter);
            var result2 = texte.Where(x => x.StartsWith("b")).OrderBy(x => x.Length).Take(3);
        }