IsNumeric, Microsoft.VisualBasic.dll, etc.


Sean and Scott’s
face="Trebuchet MS" color=teal>earlier posting face="Trebuchet MS" color=teal> on IsNumeric has resulted in a few comments…
and I just need to chime in here, use Microsoft.VisualBasic! It is all IL in the
end, right? This topic comes up over and over again on href="http://www.gotdotnet.com"> color=teal>GotDotNet, and I just
want it to go away! Almost always, someone writes up and posts a C#
implementation of IsNumeric that might be useful, but it is not equivalent to
the function from this assembly. Why write your own, incorrect or incomplete,
implementation when a highly-tested one is shipping with the Framework? Are you
going to do the same for all of the functions in the Framework?


color=teal>Microsoft.VisualBasic.dll is an assembly, it ships
with .NET, it provides useful functions… the decision to use it or not
shouldn’t be any more difficult than deciding if you are going to use any other
useful assembly. If you dig into the IL and you don’t like what it does, fine…
but I hope you are applying the same standard to all of the libraries you
use.


Comments (6)

  1. So what would stop someone from using anakrino on Microsft.VisualBasic.dll to retrieve this function in C#? Would it not then be the highly-tested one?

    If I remember correctly all one would have to do is rename the local variables to something readable.

  2. Sure, you could… you could do that to any dll in the Framework… Of course, if they improve it in a SP or a new version, you’ll have to do it again, but the real question is;

    Why Bother?

    Are you going to do that for every DLL where you want to use one function without referencing the entire assembly?

  3. Phil Scott says:

    I think these debates really show people’s stereotypes and ignorance of VB sometimes. It is kinda unfortunate some of those easy to use functions need to be imported from the VisualBasic library when using C# simply because these are handy to have, not because they exist in a dll with the worth VisualBasic in it. The mere fact that you have to type VisualBasic at one point during your app shouldn’t stop you from using good code. I mean, if there was a namespace called JavaIsCool in AdaIsTheBestLanguageEver.dll that had a function that delivered beautiful women and ice cream, I’d certainly use it.

  4. hai how to intepepreter visual basic to assembly

  5. please help about them