.net – My.Computer.FileSystem和System.IO.File之间究竟有什么
发布时间:2020-12-17 00:17:31 所属栏目:大数据 来源:网络整理
导读:My.Computer.FileSystem和System.IO.File命名空间中存在大量重复的功能. 那究竟是什么区别: My.Computer.FileSystem.CopyFile(source,dest,True) 和: System.IO.File.Copy(source,True) 是否存在性能差异?什么是每个人对哪些具有阅读能力优势的看法?我个
My.Computer.FileSystem和System.IO.File命名空间中存在大量重复的功能.
那究竟是什么区别: My.Computer.FileSystem.CopyFile(source,dest,True) 和: System.IO.File.Copy(source,True) 是否存在性能差异?什么是每个人对哪些具有阅读能力优势的看法?我个人使用My.Computer命名空间,但这只是习惯.
我的.*只是为VB.NET实现的一组Facade模式类,包含常见的System.IO *(和其他)操作.由于你经历了一个额外的抽象层,所以有一个非常微小的性能损失,但你必须决定它是否值得优化.我建议使用对你和你店里的其他人有意义的方式.
如果使用.NET Reflector检查My.Computer.FileSystem.CopyFile的代码,您将看到该方法包装了许多System.IO类,例如File和Directory,尤其是File类的Copy,Move和Delete方法.片段: 'lots of other code snipped out for brevity and to show the use of System.IO classes... Directory.CreateDirectory(FileSystem.GetParentPath(str)) 'snip If ' snip Else File.Delete(str) File.Move(path,str) End If Else File.Move(path,str) End If End Sub (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |