Exemple #1
0
        static void Main4(string[] args)
        {
            // multicast inheritance example
            Del1 ob;

            ob = new Del1(Display);
            ob();// display()

            Console.WriteLine();
            Console.WriteLine();

            ob += new Del1(Show); // now ob is pointing to both display and show
            ob();                 // display() show()

            Console.WriteLine();
            Console.WriteLine();

            ob += new Del1(Display);
            ob();// display()


            Console.WriteLine();
            Console.WriteLine();


            ob -= new Del1(Display); //removes the latest added Display
            ob();                    // Display() show()
            Console.ReadLine();
        }
Exemple #2
0
    public static int Main(string[] args)
    {
        // newobj Derived
        Derived d = new Derived();
        // ldvirtftn Base::Foo
        // newobj Del1::.ctor
        Del1 b = new Del1(d.Foo);
        // ldftn Del1::Invoke
        // newobj Del2::.ctor
        Del2 f = new Del2(b.Invoke);
        // should call Derived.Foo not Base.Foo
        var r = f("Derived.Foo");

        if (r != WasCalled.DerivedWasCalled)
        {
            return(1);
        }
        // should call Base.Foo not Derived.Foo
        var boundDelegate = (Del2)Activator.CreateInstance(typeof(Del2), b, typeof(Base).GetMethod(nameof(Base.Foo)).MethodHandle.GetFunctionPointer());

        r = boundDelegate("Base.Foo");
        if (r != WasCalled.BaseWasCalled)
        {
            return(2);
        }
        return(0);
    }
Exemple #3
0
        public Form1()
        {
            InitializeComponent();
            startBC();
            graphOpened = false;
            expressionTextBox.Select();
            grafoveOkno = null;
            InitializeTooltips();
            pamet      = new string[10];
            delButtons = new Button[7];
            for (int i = 0; i < 10; i++)
            {
                pamet[i] = "Memory " + (1 + i).ToString();
            }
            memoryComboBox.SelectedIndex = 0;
            delButtons[0] = Del0;;
            delButtons[1] = Del1;;
            delButtons[2] = Del2;;
            delButtons[3] = Del3;;
            delButtons[4] = Del4;;
            delButtons[5] = Del5;;
            delButtons[6] = Del6;;
            Del0.Hide();
            Del1.Hide();
            Del2.Hide();
            Del3.Hide();
            Del4.Hide();
            Del5.Hide();
            Del6.Hide();

            favButtons = new List <Button>();
        }
Exemple #4
0
        static void Main8()
        {
            Del1 o = new Del1(Display);

            o  = Display;
            o += Show;
            o += Display;
            o += Show;

            o();

            Console.WriteLine();

            //Object Delegate MultiCastDelegate YourDel


            Del1 o1 = Display;
            Del1 o2 = Show;

            o = (Del1)Delegate.Combine(o1, o2);
            o();
            o = (Del1)Delegate.Combine(o, o1, o2);
            Console.WriteLine();
            o();
            Console.WriteLine();
            o = (Del1)Delegate.RemoveAll(o, o1);
            o();

            Console.ReadLine();
        }
        static void Main1()
        {
            Del1 objDel = new Del1(Display);

            objDel();
            Console.ReadLine();
        }
Exemple #6
0
        static void Main(string[] args)
        {
            //Del1 d1 = new Del1(Display);
            //d1();
            //Console.WriteLine();
            //d1 += new Del1(Show);
            //d1();
            //Console.WriteLine();
            //d1 += new Del1(Display);
            //d1();
            //Console.WriteLine();
            //d1 -= new Del1(Display);
            //d1();

            ////optimize syntax
            //Console.WriteLine();
            //d1 -= Show;
            //d1();
            //Console.WriteLine();
            //d1 += Show;
            //d1();

            //Delegate.CreateDelegate(); -- not i csharp


            Del1 d = (Del1)Delegate.Combine(new Del1(Display), new Del1(Show), new Del1(Display));

            d();

            Console.WriteLine();
            d = (Del1)Delegate.Remove(d, new Del1(Display));

            d();
        }
Exemple #7
0
        static void Main3()
        {
            Del1 objDel;

            objDel = new Del1(Display);
            objDel();


            Console.WriteLine();
            Console.WriteLine();
            objDel += new Del1(Show);
            objDel();


            Console.WriteLine();
            Console.WriteLine();
            objDel += new Del1(Display);
            objDel();

            Console.WriteLine();
            Console.WriteLine();
            objDel -= new Del1(Display);
            objDel();

            Console.ReadLine();
        }
Exemple #8
0
        static void Main1(string[] args)
        {
            Del1 ob = new Del1(Display); // step 2 -> ob is pointing to function display()

            ob();                        // step 3 invoke Display using delegate

            Console.ReadLine();
        }
 static void Main2()
 {
     Console.WriteLine("Before");
     Del1 obj = Display;
     obj.BeginInvoke("aaa", null, null);
     Console.WriteLine("After");
     Console.ReadLine();
 }
Exemple #10
0
        static void Main(string[] args)
        {
            Del1 objDel = new Del1(Display);

            objDel();

            Console.ReadLine();
        }
        /// <summary>
        /// 总结:事件是基于委托实现的
        /// 联系:
        ///     1.事件是基于委托实现的,可以通俗地理解为:事件是一种特殊的委托,特殊的地方在于它定义的是一个有两个参数(事件源和事件参数)没有返回值的委托;并且事件只能出现在 += 、-= 操作符左边
        ///     2.当事件的订阅者订阅事件时,本质上是将事件的处理方法加入到委托链中,当事件触发时,委托链中的所有事件处理方法都会被调用
        /// 区别:
        ///     委托的本质是一种自定义类型(class),而事件的本质是一个特殊的委托实例(对象)
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args) {
            Del1 del1 = () => Console.WriteLine("猫叫了");
            del1 += () => Console.WriteLine("老鼠逃走了:我勒个去,赶紧跑啊!");
            del1 += () => Console.WriteLine("主人醒了:我勒个去,叫个锤子啊!");

            del1();

        }
Exemple #12
0
		[Category ("NotWorking")] // #14163
#endif
		public void NullTarget_Instance ()
		{
			Del1 d = (Del1)Delegate.CreateDelegate (typeof (Del1), null, typeof (DelegateTest).GetMethod ("method1"));

			DelegateTest dt = new DelegateTest ();
			dt.int_field = 5;

			Assert.AreEqual (10, d (dt, 5));
		}
 static void Main3()
 {
     Console.WriteLine("Before");
     Del1 obj = Display;
     obj.BeginInvoke("aaa", new AsyncCallback(CallbackFunction) , null);
     //cw(retval);
     Console.WriteLine("After");
     Console.ReadLine();
 }
Exemple #14
0
 public StartScreen()
 {
     InitializeComponent();
     // Instantiate the delegate.
     handler = makeVisible;
     join = joining;
     start = starting;
     invisible = makeInvisible;
 }
Exemple #15
0
        static void Main1()
        {
            //step 2: create obj of del class passing fn name as a param
            Del1 objDel = new Del1(Display);

            //step 3: call fn with del obj
            objDel();
            Console.ReadLine();
        }
Exemple #16
0
        private void m1(IAsyncResult ar)
        {
            Console.WriteLine($"m1() thread = {Thread.CurrentThread.ManagedThreadId}");
            AsyncResult resultc = (AsyncResult)ar;
            Del1        dd      = (Del1)resultc.AsyncDelegate;

            Console.WriteLine("sum = " + dd.EndInvoke(resultc));
            Console.WriteLine(ar.AsyncState);
        }
Exemple #17
0
        static void Main(string[] args)
        {
            Del1 de1 = null;

            de1 += summ;
            de1 += summ2;
            de1 += summ3;
            de1(1, 3.5);
        }
        static void Main1()
        {
            //step 2 : create a delegate object the function name as a parameter
            Del1 objDel  = new Del1(display);
            Del2 objDel2 = new Del2(display1);

            //step 3 : call the func via delegate obj
            objDel();
            objDel2(1);
        }
Exemple #19
0
        static void Main1()
        {
            //Del1 o = new Del1(Method1);
            //o();
            Del1 o = delegate() { Console.WriteLine("method called"); };

            o();

            Console.ReadLine();
        }
        static void Main4()
        {
            Console.WriteLine("Before");
            obj = Display;
            IAsyncResult ar = obj.BeginInvoke("aaa", new AsyncCallback(CallbackFunction), null);


            Console.WriteLine("After");
            Console.ReadLine();
        }
Exemple #21
0
        static void Main(string[] args)
        {
            SampleClass sc = new SampleClass();
            Del1        d1 = sc.InstanceMethod;

            d1();
            d1 = SampleClass.StaticMethod;
            d1();
            Console.Read();
        }
Exemple #22
0
        //static int Sum(int x, int y)
        //{
        //    return x + y;
        //}
        static void Main(string[] args)
        {
            //Del obj1 = delegate(int x, int y) { return x + y; };
            Del  obj1 = (x, y) => x + y;
            Del1 obj2 = x => x * x;

            Console.WriteLine(obj1(4, 5));
            Console.WriteLine(obj2(122));
            Console.ReadLine();
        }
Exemple #23
0
        internal static List <string> gfForEach(this List <string> list, Del1 fun)
        {
            var result = new List <string>();

            for (var i = 0; i < list.Count; ++i)
            {
                result.Add(fun(list[i]));
            }
            return(result);
        }
Exemple #24
0
        static void Main7()
        {
            Del1 o = new Del1(Display);

            o  = Display;
            o += Show;
            o -= Display;

            Console.ReadLine();
        }
Exemple #25
0
        static void Main1(string[] args)
        {
            //Display
            Program a      = new Program();
            Del1    objDel = new Del1(a.Display2);

            objDel(10);

            Console.ReadLine();
        }
        static void Main5()
        {
            Console.WriteLine("Before");
            Del1 obj = Display;
            //IAsyncResult ar = obj.BeginInvoke("aaa", new AsyncCallback(CallbackFunction), "some data here");
            IAsyncResult ar = obj.BeginInvoke("aaa", new AsyncCallback(CallbackFunction), obj);

            Console.WriteLine("After");
            Console.ReadLine();
        }
Exemple #27
0
        static void Main2()
        {
            //Del1 objDel = new Del1(Display);
            Del1 objDel;

            objDel = new Del1(Display);
            objDel();
            objDel = new Del1(Show);
            objDel();
            Console.ReadLine();
        }
Exemple #28
0
        static void Main1()
        {
            //Display();
            //step 2 : create a delegate object passing the function name as a parameter.
            Del1 objDel = new Del1(Display);

            //step 3 : call the func via the delegate object
            objDel();

            Console.ReadLine();
        }
Exemple #29
0
        static void Main2(string[] args)
        {
            // using single delegates calling two methods
            Del1 ob;

            ob = new Del1(Display);
            ob();

            ob = new Del1(Show);
            ob();
            Console.ReadLine();
        }
        void CallbackFunction(IAsyncResult ar)
        {
            Console.WriteLine("call back func called");

            //string data = ar.AsyncState.ToString();
            //Console.WriteLine(data);

            Del1 obj = (Del1)ar.AsyncState;

            string retval = obj.EndInvoke(ar);
            Console.WriteLine(retval);
        }
Exemple #31
0
        public void Met2()
        {
            Console.WriteLine($"Main() thread = {Thread.CurrentThread.ManagedThreadId}");
            del2 = new Del1(Add2);
            IAsyncResult async = del2.BeginInvoke(10, 10, new AsyncCallback(m1), "barev #######");

            Console.WriteLine("Doing more work in Main()!");
            //for (int i = 0; i <= 30; i++)
            //{
            //    Console.WriteLine("#######" + i);
            //}
            Thread.Sleep(1000);
        }
Exemple #32
0
 public Boolean runTest()
   {
   int iCountTestcases = 0;
   int iCountErrors    = 0;
   iCountTestcases++;
   IAsyncResult void_void_result = null;
   try {
   ExecClass eClass = new ExecClass ();
   dlg_void_void inst_dlg_void_void = new dlg_void_void (eClass.execMethod_void_void);
   CallbkClass cbClass = new CallbkClass();
   AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_void_void);
   Object state = new Object();
   void_void_result = inst_dlg_void_void.BeginInvoke (cb, state);
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_001,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   IAsyncResult String_String_result = null;
   try {
   ExecClass eClass = new ExecClass ();
   dlg_String_String inst_dlg_String_String = new dlg_String_String (eClass.execMethod_String_String);
   CallbkClass cbClass = new CallbkClass();
   AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_String_String);
   Object state = new Object();
   String temp = ExecClass.param_String;
   String_String_result = inst_dlg_String_String.BeginInvoke (ref temp, cb, state);
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_001,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   IAsyncResult Boolean_Boolean_result = null;
   try {
   ExecClass eClass = new ExecClass ();
   dlg_Boolean_Boolean inst_dlg_Boolean_Boolean = new dlg_Boolean_Boolean (eClass.execMethod_Boolean_Boolean);
   CallbkClass cbClass = new CallbkClass();
   AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_Boolean_Boolean);
   Object state = new Object();
   Boolean temp = ExecClass.param_Boolean;
   Boolean_Boolean_result = inst_dlg_Boolean_Boolean.BeginInvoke (ref temp, cb, state);
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_003,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   IAsyncResult SByte_SByte_result = null;
   try {
   ExecClass eClass = new ExecClass ();
   dlg_SByte_SByte inst_dlg_SByte_SByte = new dlg_SByte_SByte (eClass.execMethod_SByte_SByte);
   CallbkClass cbClass = new CallbkClass();
   AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_SByte_SByte);
   Object state = new Object();
   SByte temp = ExecClass.param_SByte;
   SByte_SByte_result = inst_dlg_SByte_SByte.BeginInvoke (ref temp, cb, state);
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_004,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   IAsyncResult Byte_Byte_result = null;
   try {
   ExecClass eClass = new ExecClass ();
   dlg_Byte_Byte inst_dlg_Byte_Byte = new dlg_Byte_Byte (eClass.execMethod_Byte_Byte);
   CallbkClass cbClass = new CallbkClass();
   AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_Byte_Byte);
   Object state = new Object();
   Byte temp = ExecClass.param_Byte;
   Byte_Byte_result = inst_dlg_Byte_Byte.BeginInvoke (ref temp, cb, state);
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_005,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   IAsyncResult char_char_result = null;
   try {
   ExecClass eClass = new ExecClass ();
   dlg_char_char inst_dlg_char_char = new dlg_char_char (execMethod_char_char);
   CallbkClass cbClass = new CallbkClass();
   AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_char_char);
   Object state = new Object();
   char temp = ExecClass.param_char;
   char_char_result = inst_dlg_char_char.BeginInvoke (ref temp, cb, state);
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_006,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   IAsyncResult double_double_result = null;
   try {
   ExecClass eClass = new ExecClass ();
   dlg_double_double inst_dlg_double_double = new dlg_double_double (eClass.execMethod_double_double);
   CallbkClass cbClass = new CallbkClass();
   AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_double_double);
   Object state = new Object();
   double temp = ExecClass.param_double;
   double_double_result = inst_dlg_double_double.BeginInvoke (ref temp, cb, state);
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_007,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   IAsyncResult float_float_result = null;
   try {
   ExecClass eClass = new ExecClass ();
   dlg_float_float inst_dlg_float_float = new dlg_float_float (eClass.execMethod_float_float);
   CallbkClass cbClass = new CallbkClass();
   AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_float_float);
   Object state = new Object();
   float temp = ExecClass.param_float;
   float_float_result = inst_dlg_float_float.BeginInvoke (ref temp, cb, state);
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_008,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   IAsyncResult long_long_result = null;
   try {
   ExecClass eClass = new ExecClass ();
   dlg_long_long inst_dlg_long_long = new dlg_long_long (eClass.execMethod_long_long);
   CallbkClass cbClass = new CallbkClass();
   AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_long_long);
   Object state = new Object();
   long temp = ExecClass.param_long;
   long_long_result = inst_dlg_long_long.BeginInvoke (ref temp, cb, state);		
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_009,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   IAsyncResult short_short_result=null; 
   try {
   ExecClass eClass = new ExecClass ();
   dlg_short_short inst_dlg_short_short = new dlg_short_short (eClass.execMethod_short_short);
   CallbkClass cbClass = new CallbkClass();
   AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_short_short);
   Object state = new Object();
   short temp = ExecClass.param_short;
   short_short_result = inst_dlg_short_short.BeginInvoke (ref temp, cb, state);
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_010,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   IAsyncResult int_int_result = null;
   try {
   ExecClass eClass = new ExecClass ();
   dlg_int_int inst_dlg_int_int = new dlg_int_int (eClass.execMethod_int_int);
   CallbkClass cbClass = new CallbkClass();
   AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_int_int);
   Object state = new Object();
   int temp = ExecClass.param_int;
   int_int_result = inst_dlg_int_int.BeginInvoke (ref temp, cb, state);
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_011,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   try{
   while (!(short_short_result.IsCompleted &&	
	    void_void_result.IsCompleted &&
	    String_String_result.IsCompleted &&
	    Boolean_Boolean_result.IsCompleted &&
	    SByte_SByte_result.IsCompleted &&
	    Byte_Byte_result.IsCompleted &&
	    char_char_result.IsCompleted &&
	    double_double_result.IsCompleted &&
	    float_float_result.IsCompleted &&
	    long_long_result.IsCompleted &&
	    short_short_result.IsCompleted &&
	    int_int_result.IsCompleted))
     {
     ExecClass.resetValues();
     }
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_ddd,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   ExecClass.resetValues();
   iCountTestcases++;
   try {
   ExecClass eClass = new ExecClass ();
   dlg_all inst_dlg_all = new dlg_all (eClass.execMethod_all);
   CallbkClass cbClass = new CallbkClass();
   AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_all);
   Object state = new Object();
   String st	=	ExecClass.param_String;
   Boolean bo	=	ExecClass.param_Boolean;
   SByte sb	=	ExecClass.param_SByte;
   Byte by		=	ExecClass.param_Byte;
   char c 		=	ExecClass.param_char;
   double d	=	ExecClass.param_double;
   float f		=	ExecClass.param_float;
   long l		=	ExecClass.param_long;
   short sh	=	ExecClass.param_short;
   int i		=	ExecClass.param_int;
   IAsyncResult all_result = inst_dlg_all.BeginInvoke (ref st, ref bo, ref sb, ref by, ref c, ref d, 
						       ref f, ref l, ref sh, ref i, cb, state);
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_012,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   try {
   dlg_all static_dlg_all = new dlg_all (ExecClass.static_execMethod_all);
   CallbkClass cbClass = new CallbkClass();
   AsyncCallback cb = new AsyncCallback (cbClass.callbkMethod_all);
   Object state = new Object();
   String st	=	ExecClass.param_String;
   Boolean bo	=	ExecClass.param_Boolean;
   SByte sb	=	ExecClass.param_SByte;
   Byte by		=	ExecClass.param_Byte;
   char c	 	=	ExecClass.param_char;
   double d	=	ExecClass.param_double;
   float f		=	ExecClass.param_float;
   long l		=	ExecClass.param_long;
   short sh	=	ExecClass.param_short;
   int i		=	ExecClass.param_int;
   IAsyncResult all_result = static_dlg_all.BeginInvoke (ref st, ref bo, ref sb, ref by, ref c, ref d, 
							 ref f, ref l, ref sh, ref i, cb, state);
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_013,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   ExecClass.resetValues();
   iCountTestcases++;
   try {
   dlg_void_void static_dlg_void_void = new dlg_void_void (ExecClass.static_execMethod_void_void);
   CallbkClass cbClass = new CallbkClass();
   void_void_result = static_dlg_void_void.BeginInvoke (null, null);
   void_void_result.AsyncWaitHandle.WaitOne(10000, false);
   if (void_void_result.IsCompleted) {
   static_dlg_void_void.EndInvoke(void_void_result);
   }
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_014,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   try {
   dlg_int_int static_dlg_int_int = new dlg_int_int (ExecClass.static_execMethod_int_int);
   CallbkClass cbClass = new CallbkClass();
   int temp = ExecClass.param_int;
   int_int_result = static_dlg_int_int.BeginInvoke (ref temp, null, null);
   int_int_result.AsyncWaitHandle.WaitOne(10000, false);
   int result = ExecClass.const_int;
   if (int_int_result.IsCompleted) {			
   static_dlg_int_int.EndInvoke(ref result, int_int_result);
   }
   if (result!=ExecClass.param_int) {
   throw (new Exception ("Err_Yeh_run_15: int parameter has a wrong value"));
   }
   if (ExecClass.value_int!=ExecClass.const_int) {
   throw (new Exception ("Err_Yeh_run_15: int returned has a wrong value"));
   }
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_015,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   try {
   dlg_String_String static_dlg_String_String = new dlg_String_String (ExecClass.static_execMethod_String_String);
   CallbkClass cbClass = new CallbkClass();
   String temp = ExecClass.param_String;
   String_String_result = static_dlg_String_String.BeginInvoke (ref temp, null, null);
   String_String_result.AsyncWaitHandle.WaitOne(10000, false);
   String result = ExecClass.const_String;
   if (String_String_result.IsCompleted) {			
   static_dlg_String_String.EndInvoke(ref result, String_String_result);
   }
   if (result!=ExecClass.param_String) {
   throw (new Exception ("Err_Yeh_run_16: String parameter has a wrong value"));
   }
   if (ExecClass.value_String!=ExecClass.const_String) {
   throw (new Exception ("Err_Yeh_run_16: String returned has a wrong value"));
   }
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_016,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   try {
   dlg_Boolean_Boolean static_dlg_Boolean_Boolean = new dlg_Boolean_Boolean (ExecClass.static_execMethod_Boolean_Boolean);
   CallbkClass cbClass = new CallbkClass();
   Boolean temp = ExecClass.param_Boolean;
   Boolean_Boolean_result = static_dlg_Boolean_Boolean.BeginInvoke (ref temp, null, null);
   Boolean_Boolean_result.AsyncWaitHandle.WaitOne(10000, false);
   Boolean result = ExecClass.const_Boolean;
   if (Boolean_Boolean_result.IsCompleted) {			
   static_dlg_Boolean_Boolean.EndInvoke(ref result, Boolean_Boolean_result);
   }
   if (result!=ExecClass.param_Boolean) {
   throw (new Exception ("Err_Yeh_run_17: Boolean parameter has a wrong value"));
   }
   if (ExecClass.value_Boolean!=ExecClass.const_Boolean) {
   throw (new Exception ("Err_Yeh_run_17: Boolean returned has a wrong value"));
   }
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_017,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   try {
   dlg_SByte_SByte static_dlg_SByte_SByte = new dlg_SByte_SByte (ExecClass.static_execMethod_SByte_SByte);
   CallbkClass cbClass = new CallbkClass();
   SByte temp = ExecClass.param_SByte;
   SByte_SByte_result = static_dlg_SByte_SByte.BeginInvoke (ref temp, null, null);
   SByte_SByte_result.AsyncWaitHandle.WaitOne(10000, false);
   SByte result = ExecClass.const_SByte;
   if (SByte_SByte_result.IsCompleted) {			
   static_dlg_SByte_SByte.EndInvoke(ref result, SByte_SByte_result);
   }
   if (result!=ExecClass.param_SByte) {
   throw (new Exception ("Err_Yeh_run_18: SByte parameter has a wrong value"));
   }
   if (ExecClass.value_SByte!=ExecClass.const_SByte) {
   throw (new Exception ("Err_Yeh_run_18: SByte returned has a wrong value"));
   }
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_018,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   try {
   dlg_Byte_Byte static_dlg_Byte_Byte = new dlg_Byte_Byte (ExecClass.static_execMethod_Byte_Byte);
   CallbkClass cbClass = new CallbkClass();
   byte temp = ExecClass.param_Byte;
   Byte_Byte_result = static_dlg_Byte_Byte.BeginInvoke (ref temp, null, null);
   Byte_Byte_result.AsyncWaitHandle.WaitOne(10000, false);
   byte result = ExecClass.const_Byte;
   if (Byte_Byte_result.IsCompleted) {			
   static_dlg_Byte_Byte.EndInvoke(ref result, Byte_Byte_result);
   }
   if (result!=ExecClass.param_Byte) {
   throw (new Exception ("Err_Yeh_run_19: Byte parameter has a wrong value"));
   }
   if (ExecClass.value_Byte!=ExecClass.const_Byte) {
   throw (new Exception ("Err_Yeh_run_19: Byte returned has a wrong value"));
   }
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_019,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   try {
   dlg_char_char static_dlg_char_char = new dlg_char_char (static_execMethod_char_char);
   CallbkClass cbClass = new CallbkClass();
   char temp = ExecClass.param_char;
   char_char_result = static_dlg_char_char.BeginInvoke (ref temp, null, null);
   char_char_result.AsyncWaitHandle.WaitOne(10000, false);
   char result = ExecClass.const_char;
   if (char_char_result.IsCompleted) {			
   static_dlg_char_char.EndInvoke(ref result, char_char_result);
   }
   if (result!=ExecClass.param_char) {
   throw (new Exception ("Err_Yeh_run_20: char parameter has a wrong value"));
   }
   if (ExecClass.value_char!=ExecClass.const_char) {
   throw (new Exception ("Err_Yeh_run_20: char returned has a wrong value"));
   }
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_020,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   try {
   dlg_double_double static_dlg_double_double = new dlg_double_double (ExecClass.static_execMethod_double_double);
   CallbkClass cbClass = new CallbkClass();
   double temp = ExecClass.param_double;
   double_double_result = static_dlg_double_double.BeginInvoke (ref temp, null, null);
   double_double_result.AsyncWaitHandle.WaitOne(10000, false);
   double result = ExecClass.const_double;
   if (double_double_result.IsCompleted) {			
   static_dlg_double_double.EndInvoke(ref result, double_double_result);
   }
   if (result!=ExecClass.param_double) {
   throw (new Exception ("Err_Yeh_run_21: double parameter has a wrong value"));
   }
   if (ExecClass.value_double!=ExecClass.const_double) {
   throw (new Exception ("Err_Yeh_run_21: double returned has a wrong value"));
   }
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_021,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   try {
   dlg_float_float static_dlg_float_float = new dlg_float_float (ExecClass.static_execMethod_float_float);
   CallbkClass cbClass = new CallbkClass();
   float temp = ExecClass.param_float;
   float_float_result = static_dlg_float_float.BeginInvoke (ref temp, null, null);
   float_float_result.AsyncWaitHandle.WaitOne(10000, false);
   float result = ExecClass.const_float;
   if (float_float_result.IsCompleted) {			
   static_dlg_float_float.EndInvoke(ref result, float_float_result);
   }
   if (result!=ExecClass.param_float) {
   throw (new Exception ("Err_Yeh_run_22: float parameter has a wrong value"));
   }
   if (ExecClass.value_float!=ExecClass.const_float) {
   throw (new Exception ("Err_Yeh_run_22: float returned has a wrong value"));
   }
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_022,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   try {
   dlg_long_long static_dlg_long_long = new dlg_long_long (ExecClass.static_execMethod_long_long);
   CallbkClass cbClass = new CallbkClass();
   long temp = ExecClass.param_long;
   long_long_result = static_dlg_long_long.BeginInvoke (ref temp, null, null);
   long_long_result.AsyncWaitHandle.WaitOne(10000, false);
   long result = ExecClass.const_long;
   if (long_long_result.IsCompleted) {			
   static_dlg_long_long.EndInvoke(ref result, long_long_result);
   }
   if (result!=ExecClass.param_long) {
   throw (new Exception ("Err_Yeh_run_23: long parameter has a wrong value"));
   }
   if (ExecClass.value_long!=ExecClass.const_long) {
   throw (new Exception ("Err_Yeh_run_23: long returned has a wrong value"));
   }
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_023,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   try {
   dlg_short_short static_dlg_short_short = new dlg_short_short (ExecClass.static_execMethod_short_short);
   CallbkClass cbClass = new CallbkClass();
   short temp = ExecClass.param_short;
   short_short_result = static_dlg_short_short.BeginInvoke (ref temp, null, null);
   short_short_result.AsyncWaitHandle.WaitOne(10000, false);
   short result = ExecClass.const_short;
   if (short_short_result.IsCompleted) {			
   static_dlg_short_short.EndInvoke(ref result, short_short_result);
   }
   if (result!=ExecClass.param_short) {
   throw (new Exception ("Err_Yeh_run_24: short parameter has a wrong value"));
   }
   if (ExecClass.value_short!=ExecClass.const_short) {
   throw (new Exception ("Err_Yeh_run_24: short returned has a wrong value"));
   }
   }
   catch (Exception ex){
   ++iCountErrors;
   Console.WriteLine("Err_Yeh_024,  Unexpected exception was thrown ex: " + ex.ToString());
   }	
   iCountTestcases++;
   try {
   slowmethod sm = new slowmethod();
   Del1 del1 = new Del1(sm.goslow);
   IAsyncResult ar = del1.BeginInvoke(50, null, null);
   if (ar.IsCompleted)
     throw new Exception("delegate ran *synchronously*");
   Object obj = del1.EndInvoke(ar);
   if ((int) obj != 50)
     throw new Exception("EndInvoke returned wrong value");
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Err_001a,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   iCountTestcases++;
   try {
   slowmethod sm = new slowmethod();
   Del1 del1 = new Del1(sm.goslow);
   IAsyncResult ar = del1.BeginInvoke(50, null, null);
   Thread.Sleep(100);
   if (! ar.IsCompleted)
     throw new Exception("delegate ran synchronously");
   Object obj = del1.EndInvoke(ar);
   if ((int) obj != 50)
     throw new Exception("EndInvoke returned wrong value");
   }
   catch (Exception ex) {
   ++iCountErrors;
   Console.WriteLine("Err_002a,  Unexpected exception was thrown ex: " + ex.ToString());
   }
   if ( iCountErrors == 0 ) {   return true; }
   else {  return false;}
   }