Deletes the file specified by the fully qualified path. An exception is not thrown if the specified file does not exist.
[Visual Basic] Overloads Public Shared Sub Delete( _ ByVal path As String _ ) [C#] public static void Delete( string path ); [C++] public: static void Delete( String* path ); [JScript] public static function Delete( path : String );
Exception Type | Condition |
---|---|
ArgumentNullException | path is a null reference (in Visual Basic Nothing). |
IOException | The target file is open or memory mapped on a machine running Windows NT. |
SecurityException | The caller does not have the required permission. |
ArgumentException | path is empty or contains only whitespaces. |
On a machine running Windows NT, Delete will fail for a file that is open for normal I/O or a file that is memory mapped. On Win95, the file will be deleted even if the file is in use.
NGWS Runtime Security:
FileIOPermissionAccess | Write permission to the path. |
File Class | File Members | System.IO Namespace | File.Delete Overload List