开发者

Microsoft.VisualBasic.FileIO.FileSystem.DeleteDirectory versus Directory.Delete

I stumbled upon this post while researching on the Delete Directory options available under:

  1. Microsoft.VisualBasic.FileIO.FileSystem.DeleteDirectory

  2. Directory.Delete

Is this statement true?

"Anyone says referencing the Microsoft.VisualBasic is often undesirable from within C#. Any association with VB from within C# code stri开发者_JAVA技巧kes me as undesirable"


There is nothing wrong with referencing Microsoft.VisualBasic from any .NET language. I mean, other than uneasy feelings about its name.

It contains several methods to help porting VB6 code, but it also includes a couple of interesting shortcuts, like say, the AssemblyInfo class. If you're using Windows Forms, you can gain something if you inherit from WindowsFormsApplicationBase (like easy single-instance applications, or splash screens).


Correct. The VisualBasic library is included primarily for backwards compatibility. It is greatly preferred (and probably more efficient) to use synonymous methods that are in the standard .NEt library.

Edit: But of course, for the linked post... when there is no equivalence, it's 'OK' to use the VisualBasic library

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜