跨网络复制目录和子目录以及文件的最佳实践-是否递归 [英] Best practice for copying directory and sub dir with files across network - recursive or not

查看:78
本文介绍了跨网络复制目录和子目录以及文件的最佳实践-是否递归的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请就最佳做法为我提供建议使用C#2008在网络上复制目录的所有内容.我应该使用递归吗?我已经搜索过,并且对此有很多讨论,但是我希望获得Microsoft的最新建议. 认证开发人员.今天早些时候向我保证,该论坛由Microsoft专业人士进行监控,我将在48小时内得到答复.

Please advise me on the best practice  using C# 2008 for copying all contents of a directory across network.  Should I use recursion?  I have searched and there are many discussions about this but I would like the latest advice from a Microsoft Certified Developer.  I was assured earlier today that this forum is monitored by Microsoft Professionals and I would get an answer in 48 hours.

谢谢.

 

 

 

推荐答案

SitDown,

SitDown,

对我来说,最佳实践是开发人员在不知道自己所做的事情的情况下使用的一种方法,而是给他带来较少麻烦的一种方法.

Best practise is for me another word for a method which a developer uses if he actual does not know what he does, but the one which gave him the less problems.

在Net中,没有一种真正好的方法可以轻松地在Net中快速复制完整的文件夹,但是,如果我不能说最好的话,通常在这种情况下使用旧的DOS或Shell命令会更快,更可靠.方式.

In Net there is no real good method which enables easy to copy quick a full folder in Net, however if it is the best I cannot say, often is using the old DOS or Shell commands in this case a quicker an more reliable way.

但是,一旦有了使用Net进行文件夹复制的好方法,我肯定会总是告诉您递归是一种不好的使用方式,因为您无法控制内存消耗,并且在某些时候可能会杀死它您的程序出现堆栈溢出.

But as soon as there is a good method to do a folder copy with Net I surely would always tell that recursion is a bad way to use, because you have no control over your memory consumption and it can at a certain moment kill your program with a stack overflow.

因此,我认为这并不是最好的做法,但目前情况越差越好.

So it is in my opinion not really the best practice but currently more the less worse practice.

 

 


这篇关于跨网络复制目录和子目录以及文件的最佳实践-是否递归的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆