Windows-8.1

How to Delete a File from WPF App

To delete a file in Windows using a WPF app you could use the following code:

public static void DeleteFile()
{
    string destinationFile = @"C:\images\d.jpg";
    try
    {
        File.Delete(destinationFile);
    }
    catch (IOException iox)
    {
        Console.WriteLine(iox.Message);
    }
}

Vivek Maskara

I am pursuing BTech in Software Engineering from Delhi Technological University. I develop apps, create websites and blog about my app experiences.

Read more:
How to create your first Windows Phone app
How to change the App name and Tile name of your Windows phone app
Data binding in Windows Phone app – One way binding
Close