Class RecycleBin
- Namespace
- WindowsRecylceBin
- Assembly
- WindowsRecylceBin.dll
Provides access to the Windows recycle bin and allows to restore deleted files. To create an instance of this class, use the static methods RecycleBin.ForCurrentUser() or RecycleBin.For(SecurityIdentifier sid).
public class RecycleBin : IRecycleBin
- Inheritance
-
RecycleBin
- Implements
- Inherited Members
Methods
DeletePernamently(RecycleBinEntry)
Deletes the specified recycle bin entry pernamently.
public void DeletePernamently(RecycleBinEntry entry)
Parameters
entry
RecycleBinEntryThe entry to delete.
Empty()
Empties the recycle bin. This will delete all entries pernamently.
public void Empty()
EnumerateEntries()
Enumerates all entries in the recycle bin.
public IEnumerable<RecycleBinEntry> EnumerateEntries()
Returns
For(SecurityIdentifier)
Gets the recycle bin for the specified SID.
public static RecycleBin For(SecurityIdentifier sid)
Parameters
Returns
ForCurrentUser()
Gets the recycle bin for the current user.
public static RecycleBin ForCurrentUser()
Returns
GetEntries()
Gets all entries in the recycle bin.
public List<RecycleBinEntry> GetEntries()
Returns
Restore(string)
Restores the specified file or directory. If more than one matching entry is found, the entry with the most recent deletion time is restored.
public void Restore(string orginalFilePath)
Parameters
orginalFilePath
string
Exceptions
- IOException
Thrown when the recycle bin contains no matching entry.
Restore(RecycleBinEntry)
Restores the specified recycle bin entry.
public void Restore(RecycleBinEntry entry)
Parameters
entry
RecycleBinEntryThe entry to restore.