Esempio n. 1
0
 public void TestMethod1()
 {
     //// START EMBED: Delegate expressions 2 ////
     FuncTwoInts theFunc = delegate(int one, int two)
     {
         return(one + two);
     };
     //// END EMBED ////
 }
Esempio n. 2
0
 public void TestMethod2()
 {
     //// START EMBED: Delegate expressions 3 ////
     FuncTwoInts theFunc = (one, two) =>
     {
         return(one + two);
     };
     //// END EMBED ////
 }
Esempio n. 3
0
        //// START EMBED: Delegates as parameters ////
        private static void PrintWith_2and4(FuncTwoInts func)
        {
            int result = func(2, 4);

            Console.WriteLine(result);
        }
Esempio n. 4
0
 public void TestMethod3()
 {
     //// START EMBED: Delegate expressions 4 ////
     FuncTwoInts theFunc = (one, two) => one + two;
     //// END EMBED ////
 }
Esempio n. 5
0
 private static int Add(FuncTwoInts twoInts)
 {
     return(twoInts(1, 2));
 }