Ejemplo n.º 1
0
 public static string Extend(this DelegateExtObj obj, string str)
 {
     if (obj == null)
     {
         throw new Exception();
     }
     return("Extend" + str);
 }
Ejemplo n.º 2
0
        public static void DelegateExtTest03()
        {
            var obj = new DelegateExtObj();
            Func <string, string> a = null;

            a += obj.Void;
            a += obj.Extend;
            Console.WriteLine("a=" + a("xxzz"));
        }
Ejemplo n.º 3
0
        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());
        }
Ejemplo n.º 4
0
        public static void DelegateExtTest01()
        {
            var obj = new DelegateExtObj();

            ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += obj.IntTest;
            ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest += obj.IntTest2;
            ILRuntimeTest.TestFramework.DelegateTest.IntDelegateTest(123);

            Func <DelegateExtObj, string, string> func = DelegateExtObjMethod.Extend;
            var ret = func.Invoke(obj, "1");

            if (!ret.Equals("Extend1"))
            {
                throw new Exception();
            }
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 public static string Void(this DelegateExtObj obj, string str)
 {
     Console.WriteLine(obj + " Void");
     return("Void" + str + "x");
 }
Ejemplo n.º 7
0
 public static int IntTest3(this DelegateExtObj obj, int a)
 {
     Console.WriteLine(obj + " dele3 a=" + a);
     return(a + 100);
 }
Ejemplo n.º 8
0
 public static void IntTest2(this DelegateExtObj obj, int a)
 {
     obj.AddValue(123);
     Console.WriteLine(obj + " dele2 a=" + obj.Value);
 }
Ejemplo n.º 9
0
 public static void IntTest(this DelegateExtObj obj, int a)
 {
     obj.AddValue(1);
     Console.WriteLine(obj + " dele a=" + a);
 }