Using Microsoft.VisualBasic.dll in C# projects

잠김 Using Microsoft.VisualBasic.dll in C# projects

  • 2012년 5월 29일 화요일 오전 10:51
     
     

    Hi...

    Are there any disadvantages to use the functions in Microsoft.VisualBasic.dll reference in C# projects (ex: IsNumeric, Shell, Cint, split,...) ?

모든 응답

  • 2012년 5월 29일 화요일 오전 11:06
     
     제안된 답변

    Can you please check-out below thread ?

    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/6b3c8897-6748-401c-81fa-1da421e475ee


    Regards,
    Ahmed Ibrahim
    SQL Server Setup Team
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you.
    This can be beneficial to other community members reading the thread.

  • 2012년 5월 29일 화요일 오전 11:09
     
     답변됨

    There are advantages and disadvantages of using VisualBasic classes in C#

    According to Robert Dunaway in this blog post:

    • You cannot have a hard and fast rule stating that the Microsoft.VisualBasic.dll should not be used.  In some cases I see that it certainly can and should be used.
    • Not all methods in the Microsoft.VisualBasic.dll exist in the .NET Framework.
    • Work around(s) for Microsoft.VisualBasic.dll methods are sometimes faster and sometimes slower.
    • Equivalent methods of the .NET Framework are sometimes much slower than that of Microsoft.VisualBasic.dll.

    Some examples of the above statements:

    CInt is slower than the one used in the .NET framework.

    Now() method is 15 times faster than usual DateTime.Now.



    • 편집됨 FlashCube 2012년 5월 29일 화요일 오전 11:10
    • 편집됨 FlashCube 2012년 5월 29일 화요일 오전 11:11
    • 답변으로 표시됨 BGQQ 2012년 5월 29일 화요일 오후 4:37
    •  
  • 2012년 5월 29일 화요일 오전 11:14
     
     

    Hi,

    This is basically to support using some traditional VB keywords so even though this is a library as any other it's a bit weird to use VB like keywords in a C# app rather than the .NET equivalent (AFAIK it is missing on some platform depending on what you are targetting).

    In short I would see this is the other way round. Why to use this DLL when alsmot if not all its function have a .NET counterpart ? (Decimal.TryParse, Process.Start, (int) casting, String.Split etc...)


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".

  • 2012년 5월 29일 화요일 오후 3:23
    중재자
     
     

    I liked the SplashScreen thingy that was defined in that DLL.

    http://social.msdn.microsoft.com/Forums/en/winforms/thread/32e83eda-7a7e-4b5f-a166-f3cd8620bdc2

    Rudy   =8^D


    Mark the best replies as answers. "Fooling computers since 1971."

    http://thesharpercoder.blogspot.com/

  • 2012년 5월 29일 화요일 오후 4:00
     
     

    If you want to use the visualbasic.dll just to use functions for which there are other equivalents in C# (i.e. CInt, Split) then you should talk with your team and decide if, as a whole, you want to do this or not.  If you have a lot of programmers with a VB background it may be more familiar, and therefore easier to read and understand code using those methods.  If you're one of just a few VB programmers on your team and most everyone else isn't familiar with those VB style methods, then you may decide that they should be avoided unless there is a compelling reason not to.

    If you're using it for some class that doesn't have comparable functionality elsewhere (a few examples are given, and one that I use a lot is TextFieldParser, for which there is no equivalent in the C# System.dll.) then there is no problem that I see with using vb.dll.

  • 2012년 5월 30일 수요일 오전 12:04
     
     

    Just to clarify something - the VisualBasic dll does not provide support for VB keywords - that is done by the language.  "CInt" is a keyword, not a method, and is not available from C#, for example.  This dll does allow things like VB string functions (Split, Left, etc).


    Convert between VB, C#, C++, & Java (http://www.tangiblesoftwaresolutions.com)