public static void DelegateExtTest04() { var obj = new DelegateExtObj(); Func <string> a = null; var o1 = new DelegateTestCls(11); a += o1.GetString; Console.WriteLine("no extend method lambda a=" + a()); }
public static int DelegateTest05() { testDele += IntTest3; DelegateTestCls cls = new DelegateTestCls(1000); testDele += cls.IntTest3; int val = testDele(123); return(val); }
public static int DelegateTest03() { ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest2 += IntTest3; DelegateTestCls cls = new DelegateTestCls(1000); ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest2 += cls.IntTest3; int val = ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest2(123); return(val); }
public static void DelegateTest01() { ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += IntTest; ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += IntTest2; DelegateTestCls cls = new DelegateTestCls(1000); ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += cls.IntTest; ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += cls.IntTest2; ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest(123); }
public static void DelegateTest33() { DelegateTestCls cls = new DelegateTestCls(100); ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest2 = Delegate.CreateDelegate(typeof(IntDelegate2), cls, typeof(DelegateTestCls).GetMethod(nameof(DelegateTestCls.IntTest3))) as IntDelegate2; var res = ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest2(100); if (res != 300) { throw new Exception(); } }
public static void DelegateTest31() { DelegateTestCls cls = new DelegateTestCls(100); testDele = Delegate.CreateDelegate(typeof(TestDelegate), cls, typeof(DelegateTestCls).GetMethod(nameof(DelegateTestCls.IntTest3))) as TestDelegate; var res = testDele(100); if (res != 300) { throw new Exception(); } }
public static void DelegateTest02() { Action <int> a = null; a += IntTest; a += IntTest2; DelegateTestCls cls = new DelegateTestCls(1000); a += cls.IntTest; a += cls.IntTest2; a += (i) => { Console.WriteLine("lambda a=" + i); }; a(123); }
public static int DelegateTest04() { Func <int, int> a = null; a += IntTest3; DelegateTestCls cls = new DelegateTestCls(1000); a += cls.IntTest3; a += (i) => { Console.WriteLine("lambda a=" + i); return(i + 300); }; int val = a(123); return(val); }
public static void DelegateExtTest02() { var obj = new DelegateExtObj(); Action <int> a = null; a += obj.IntTest; a += obj.IntTest2; DelegateTestCls cls = new DelegateTestCls(1000); a += cls.IntTest; a += cls.IntTest2; a += (i) => { Console.WriteLine("lambda a=" + i); }; a.Invoke(124); Console.WriteLine("obj Value=" + obj.Value); }
public static void DelegateTest01() { ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += IntTest; ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += IntTest2; DelegateTestCls cls = new DelegateTestCls(1000); ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += cls.IntTest; ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += cls.IntTest2; ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest(123); ILRuntimeTest.TestFramework.DelegateTest.IntDelegateEventTest += IntTest; ILRuntimeTest.TestFramework.DelegateTest.TestEvent(); ILRuntimeTest.TestFramework.DelegateTest.IntDelegateEventTest -= IntTest; ILRuntimeTest.TestFramework.DelegateTest test = new ILRuntimeTest.TestFramework.DelegateTest(); test.IntDelegateEventTest2 += IntTest; test.TestEvent2(); test.IntDelegateEventTest2 -= IntTest; }
public static void DelegateTest15() { DelegateTestCls cls = new DelegateTestCls(123); DelegateTest15Sub(cls.IntTest); }