Which snippet will you use to delete file named "file"?
Answers
Parameters
path
String
The name of the file to be deleted. Wildcard characters are not supported.
Exceptions
ArgumentException
path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
ArgumentNullException
path is null.
DirectoryNotFoundException
The specified path is invalid (for example, it is on an unmapped drive).
IOException
The specified file is in use.
-or-
There is an open handle on the file, and the operating system is Windows XP or earlier. This open handle can result from enumerating directories and files. For more information, see How to: Enumerate Directories and Files.
NotSupportedException
path is in an invalid format.
PathTooLongException
The specified path, file name, or both exceed the system-defined maximum length.
UnauthorizedAccessException
The caller does not have the required permission.
-or-
The file is an executable file that is in use.
-or-
path is a directory.
-or-
path specified a read-only file.