[DllImport("kernel32.dll"), SetLastError=true]
static extern bool DeleteFile(string lpFileName);
None.
None.
You can delete Alternate Data Streams (ADS). For example, to delete the ZoneId from a file:
DeleteFile(filename + ":Zone.Identifier");
N.B. You can't delete ADS using the managed APIs.
Always check the return value as false indicates failure. You can throw the appropriate .NET exception automatically by doing the following:
if(!DeleteFile(filename)) {
Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
}
System.IO.File:
public static void Delete(string path);