C# FileInfo Delete

Description

FileInfo Delete Permanently deletes a file.

Syntax

FileInfo.Delete has the following syntax.


public override void Delete()

Returns

FileInfo.Delete method returns

Example

The following example demonstrates the Delete method.


//from   ww w .  j  av  a 2 s  . c o m
using System;
using System.IO;

class Test 
{
    public static void Main() 
    {
        string path = @"c:\MyTest.txt";
        FileInfo fi1 = new FileInfo(path);

        fi1.Delete();
    }
}




















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter