怎么样去掉代码中的DOTO语句,分不多,请各位帮忙!!

.Net技术 码拜 9年前 (2015-05-10) 543次浏览 0个评论
 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
        public void aa(int b, bool a, int c)
        {
            switch (b)
            {
                case 1:
                    if (a)
                    {
                        break;
                    }
                    goto Label_2A7D;

                case 2:
                    if (a)
                    {
                        goto Label_29DD;
                    }
                    goto Label_2A7D;

                default:
                    goto Label_2A7D;
            }
            if (c != 1)
            {
                throw new Exception(” c”);
            }
            goto Label_2A7D;
        Label_29DD: ;

            MessageBox.Show(“Label_29DD”);

        Label_2A7D:

            MessageBox.Show(“Label_2A7D”);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            aa(1, false, 1);
            aa(1, true, 1);
            aa(2, false, 1);
            aa(2, true, 1);            
        }
    }
}

30分
你这个是反编译的代码吧  建议仔细看看 或者你编译个源代码,然后对照反编译和源代码就知道了
10分
goto Label_2A7D; 把这句话直接换成相应位置的代码就好了 你试试吧
引用 2 楼 lucky5022 的回复:

goto Label_2A7D; 把这句话直接换成相应位置的代码就好了 你试试吧

  你说的这个方法我试过
但是 我的Label_2A7D:代码段都是很长的,而且Label_2A7D:代码段中有穿插其他GOTO语句的现象
郁闷啊!

引用 1 楼 lucky5022 的回复:

你这个是反编译的代码吧 建议仔细看看 或者你编译个源代码,然后对照反编译和源代码就知道了

兄弟说的可以一试,尝试中……


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明怎么样去掉代码中的DOTO语句,分不多,请各位帮忙!!
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!