I want my application to clean all the temp files it used, the problem is that not all the temp files are under my control, so I just want to "brutally" unlock them in order to delete them programatically.
C# – How to unlock a file that is locked by a process in .NET
cfile-lockingtemporary-files
Related Topic
- C# – Case insensitive ‘Contains(string)’
- C# – LINQ’s Distinct() on a particular property
- C# – When should I use a struct rather than a class in C#
- C# – How to create a temp file with a specific extension with .NET
- C# – How to remedy “The breakpoint will not currently be hit. No symbols have been loaded for this document.” warning
- C# – reason for C#’s reuse of the variable in a foreach
- C# – If a folder does not exist, create it
- Scala: list.flatten: no implicit argument matching parameter type (Any) = > Iterable[Any] was found
Best Answer
Take a look at this article. I think that you'll struggle to do this in C# natively, even using interop, but writing a C++/CLI wrapper assembly may be a good compromise. Note also that the user needs to have the SE_DEBUG privilege for this to work.