As the title says is which one of the scenarios below is faster?
// Using FileInfo
FileInfo file = new FileInfo(@"C:\Test.txt");
if (file.Exists)
file.CopyTo(@"C:\TestCopy.txt");
// Using File
if (File.Exists(@"C:\Test.txt"))
File.Copy(@"C:\Test.txt", @"C:\TestCopy.txt");
I know the FileInfo is easier for the eye to read, but is one method faster than the other?