标题:请问以下程序中catch中的return有什么用
取消只看楼主
恶魔城主
Rank: 1
等 级:新手上路
帖 子:8
专家分:7
注 册:2012-3-11
结帖率:75%
已结贴  问题点数:20 回复次数:0 
请问以下程序中catch中的return有什么用
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using

namespace 文件使用
{
    class Program
    {
        public static void Main()
        {
            string[] CLA = Environment.GetCommandLineArgs();
            Console.WriteLine(CLA[0]);
              if (CLA.Length < 3)
             {
               Console.WriteLine("Format:{0} orig-file new-file",CLA[0]);

            }
            else {
          string origfile;
            origfile = CLA[1];
            string newfile;
            newfile = CLA[2];
   try
              {
                  File.Copy(origfile, newfile );
              }
              catch () { Console.WriteLine("{0}dose not exist", origfile);
              return;
              }
              catch (Exception e) { Console.WriteLine("An exception was thrown trying to copy file.");
              return;
              }


          Console.WriteLine("Copy...");

            }

           
       Console.WriteLine(".....Done");
        }
    }
}
搜索更多相关主题的帖子: void return public 
2012-07-24 18:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-374036-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.082691 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved