See the question and my original answer on StackOverflow

Here is a simple solution that should work from .NET Framework 4 to latest .NET Core (currently 8) without any reference needed. It's technically the same as user4584267's one but w/o the need to create a COM interop file, since it uses C# dynamic keyword:

static void MoveToRecycleBin(string fileOrDirectoryPath)
{
    // from https://learn.microsoft.com/en-us/windows/win32/api/shldisp/ne-shldisp-shellspecialfolderconstants
    const int ssfBITBUCKET = 0xa;
    dynamic shell = Activator.CreateInstance(Type.GetTypeFromProgID("Shell.Application"));
    var recycleBin = shell.Namespace(ssfBITBUCKET);
    recycleBin.MoveHere(fileOrDirectoryPath);
}