Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FileIO.FileSystem.CopyFile() vs System.IO.File.Copy()

Tags:

.net

copy

vb.net

I have a couple of questions about the difference between this 2 classes and these specific methods, FileIO.FileSystem.CopyFile() and System.IO.File.Copy()

At the simplest level, they both do the same thing when overloaded with sourceFile, destinationFile and bool set to true to overwrite. EG

FileIO.FileSystem.CopyFile(source, destination, True) 
System.IO.File.Copy(source, destination, True)

My two questions are

  1. What are the differences between the 2 with the overload shown because I can't find (or may be I missed the point) anything on the MSDN site.
  2. How do you (the kind person answering) know the differences when it isn't in the MSDN documentation?
like image 861
Dave Avatar asked Jan 08 '13 09:01

Dave


People also ask

How do I copy a file from one directory to another in VB net?

Use the CopyFile method to copy a file, specifying a source file and the target directory. The overwrite parameter allows you to specify whether or not to overwrite existing files.

What does file Copy do?

Definition. Copies an existing file to a new file.


1 Answers

A quick look at Microsoft.VisualBasic.dll in reflector shows FileIO.FileSystem.Copy does just hand over to File.Copy after doing a couple of sanity checks (file, directory exists for example) and creating the destination directory if needed.

like image 130
PaulB Avatar answered Nov 05 '22 12:11

PaulB