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