Note that there are some explanatory texts on larger screens.

plurals
  1. POMicrosoft.VisualBasic.FileIO.FileSystem equivalence in C#
    text
    copied!<p>I use VS 2008, .net 3.5, C# projects. I need do the same functionally like Microsoft.VisualBasic.FileIO.FileSystem.DeleteDirectory.</p> <p>Anyone says referencing the Microsoft.VisualBasic is often undesirable from within C#. Any association with VB from within C# code strikes me as undesirable. </p> <p>Using FileSystem class, this is a perfectly fine solution, but I prefer not references Microsoft.VisualBasic library. That one I would avoid. </p> <pre><code> private static void DeleteDirectory(string destino) { //UIOption Enumeration. Specifies whether to visually track the operation's progress. Default is UIOption.OnlyErrorDialogs. Required. //RecycleOption Enumeration. Specifies whether or not the deleted file should be sent to the Recycle Bin. Default is RecycleOption.DeletePermanently. //UICancelOption Enumeration. Specifies whether to throw an exception if the user clicks Cancel. Required. Microsoft.VisualBasic.FileIO.FileSystem.DeleteDirectory(destino, Microsoft.VisualBasic.FileIO.UIOption.OnlyErrorDialogs, Microsoft.VisualBasic.FileIO.RecycleOption.DeletePermanently, Microsoft.VisualBasic.FileIO.UICancelOption.ThrowException); //Directory.Delete(destino, true); } </code></pre> <p>Other samples: <a href="https://stackoverflow.com/questions/17612/how-do-you-place-a-file-in-recycle-bin-instead-of-delete">How do you place a file in recycle bin instead of delete?</a></p> <pre><code>Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile(file.FullName, Microsoft.VisualBasic.FileIO.UIOption.OnlyErrorDialogs, Microsoft.VisualBasic.FileIO.RecycleOption.SendToRecycleBin); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload