Currently I\'m using the following function
file.Delete();
But how can I use this function to send a file to the recycle bin instead of jus
The following solution is simpler than the other ones:
using Shell32;
static class Program
{
public static Shell shell = new Shell();
public static Folder RecyclingBin = shell.NameSpace(10);
static void Main()
{
RecyclingBin.MoveHere("PATH TO FILE/FOLDER")
}
}
You can use other functionalities of the recycle bin using this library.
First, don't forget to add the library "Microsoft Shell Controls And Automation" (from the COM menu), to be able to use the Shell32 namespace. It will be dynamically linked to your project, instead of being compiled along with your program.