Is there much of a difference between using the static methods of the File
object as opposed to creating a new FileInfo
object and calling those methods?
The only difference is that File
must resolve the specified path (assuming it is relative), while the FileInfo
should have already have the resolved path.
Both are calling Win32Native.DeleteFile()
It depends. If you are performing a single operation use the File
class and if you are performing multiple operations on the same file, use FileInfo
.
EDIT: I made this point as my understanding is that the File class's static methods will always check for the security. But if you are re-using the instance of FileInfo, the methods will do the security check only for the first time and not on each subsequent calls.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With