goto语句

让程序直接跳到自定义标签位置

        public static void Main(string[] args)
        {
            int a=5;
            goto myLabel;AppDomainInitializer//直接跳到标签myLabel位置
            a++;
            myLabel:Console.WriteLine(a);//5
            Console.WriteLine(a);
            Console.ReadKey();
        }

 

posted @ 2018-09-28 22:55  夕西行  阅读(129)  评论(0编辑  收藏  举报