public static int MainMethod()
            {
                bool    ret  = true;
                Foo     foo  = new Foo();
                dynamic d    = new object();
                D001    dd01 = new D001(foo.M01);

                dd01(123); // use delegate's default value

                if (123 != Foo.val)
                {
                    ret = false;
                }

                dd01(100);
                if (100 != Foo.val)
                {
                    ret = false;
                }

                Foo.val = -1;
                D001 dd11 = new D001(foo.M02);

                dd11();
                if (null != Foo.nval)
                {
                    ret = false;
                }

                dd11(101);
                if (101 != Foo.nval)
                {
                    ret = false;
                }

                D002 dd021;

                dd021 = new D002(Foo.M11);
                dd021(88);
                if (null != Foo.str)
                {
                    ret = false;
                }

                dd021(66, "boo", "Dah");
                if (0 != String.CompareOrdinal("Dah", Foo.str))
                {
                    ret = false;
                }

                dynamic dstr = "Hello";

                dd021(88, null, dstr);
                if ((string)dstr != Foo.str)
                {
                    ret = false;
                }

                D011 dd011 = new D011(foo.M21);

                dd011();
                if (Foo.nval.HasValue)
                {
                    ret = false;
                }

                dd011(102);
                if (!Foo.nval.HasValue || 102 != Foo.nval)
                {
                    ret = false;
                }

                DynClass.D021 dd21 = new DynClass.D021(Foo.M31);
                int           n    = dd21();

                n = dd21(d);
                DynClass.D022 dd22 = null;
                dd22 = new DynClass.D022(Foo.M41);
                dd22(new DynStruct01());
                if (-1 != Foo.val) // 41
                {
                    ret = false;
                }

                dd22(new DynStruct01(), 0.780f, 103);
                if (103 != Foo.val)
                {
                    ret = false;
                }

                DynClass.DynStruct.D031 dd31 = new DynClass.DynStruct.D031(Foo.M51);
                n = dd31(new DynClass01());
                if (51 != n)
                {
                    ret = false;
                }

                n = dd31(null, new DynStruct01());
                if (51 != n)
                {
                    ret = false;
                }

                n = dd31(new DynClass01(), new DynStruct01(), null);
                if (51 != n)
                {
                    ret = false;
                }

                return(ret ? 0 : 1);
            }
            public static int MainMethod()
            {
                Foo     foo = new Foo();
                dynamic d   = new object();
                object  o   = null;

                s_del001  = new D001(Foo.M01);
                s_retval -= (int)s_del001(s_sd);
                D001 d001 = new D001(foo.M02);

                s_retval -= (int)d001(o);
                d001      = new D001(foo.M03);
                s_retval -= (int)d001(s_sd);
                s_del001  = new D001(Foo.M04);
                s_retval -= (int)s_del001(d);
                D002 del002 = null;

                del002    = new D002(Foo.M05);
                s_retval -= (int)del002(d, o);
                D002 d002 = new D002(foo.M06);

                s_retval -= (int)d002(o, s_sd);
                del002    = new D002(Foo.M07);
                s_retval -= (int)del002(s_so, o);
                d002      = new D002(foo.M08);
                s_retval -= (int)d002(s_sd, s_so);
                s_del003  = new D003(Foo.M09);
                s_retval -= (int)s_del003(ref d, s_so, out s_sd);
                D003 d003 = new D003(foo.M0A);

                // Ex: Null ref
                // retval -= (int)d003(ref o, sd, out so);
                s_retval -= (int)d003(ref o, o, out o);
                d003      = new D003(foo.M0B);
                // Ex: Null ref
                // retval -= (int)d003(ref so, d, out d);
                s_retval -= (int)d003(ref s_so, s_so, out s_so);
                dynamic[] dary = new object[]
                {
                }

                ;
                int  ret    = 0;
                D004 del004 = new D004(Foo.M0C);

                del004(ref ret, new object[]
                {
                }

                       , dary);
                s_retval -= ret;
                del004    = new D004(foo.M0D);
                ret       = 0;
                del004(ref ret, new dynamic[]
                {
                }

                       , dary);
                s_retval -= ret;
                return(s_retval);
            }