public static int MainMethod(string[] ars)
        {
            TestClass l = new TestClass()
            {
                field = 8
            }

            ;
            Base1 r = new Base1()
            {
                field = 2
            }

            ;
            int flag = 0;
            dynamic d0 = l;
            try
            {
                d0 |= r;
            }
            catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException e)
            {
                if (ErrorVerifier.Verify(ErrorMessageId.NoImplicitConvCast, e.Message, "Base2", "TestClass"))
                {
                    flag++;
                }
            }

            dynamic d1 = l;
            dynamic d2 = r;
            try
            {
                d1 |= d2;
            }
            catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException e)
            {
                if (ErrorVerifier.Verify(ErrorMessageId.NoImplicitConvCast, e.Message, "Base2", "TestClass"))
                {
                    flag++;
                }
            }

            try
            {
                l |= d2;
            }
            catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException e)
            {
                if (ErrorVerifier.Verify(ErrorMessageId.NoImplicitConvCast, e.Message, "Base2", "TestClass"))
                {
                    flag++;
                }
            }

            if (flag == 0)
                return 0;
            return 1;
        }
示例#2
0
        public static int MainMethod(string[] ars)
        {
            TestClass l = new TestClass()
            {
                field = 8
            }

            ;
            Base1 r = new Base1()
            {
                field = 2
            }

            ;
            int     flag = 0;
            dynamic d0   = l;

            try
            {
                d0 |= r;
            }
            catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException e)
            {
                if (ErrorVerifier.Verify(ErrorMessageId.NoImplicitConvCast, e.Message, "Base2", "TestClass"))
                {
                    flag++;
                }
            }

            dynamic d1 = l;
            dynamic d2 = r;

            try
            {
                d1 |= d2;
            }
            catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException e)
            {
                if (ErrorVerifier.Verify(ErrorMessageId.NoImplicitConvCast, e.Message, "Base2", "TestClass"))
                {
                    flag++;
                }
            }

            try
            {
                l |= d2;
            }
            catch (Microsoft.CSharp.RuntimeBinder.RuntimeBinderException e)
            {
                if (ErrorVerifier.Verify(ErrorMessageId.NoImplicitConvCast, e.Message, "Base2", "TestClass"))
                {
                    flag++;
                }
            }

            if (flag == 0)
            {
                return(0);
            }
            return(1);
        }