Re: trim(string) vs string.trim



Jared wrote:
Terry,
Please note before leaving your code in place that the Trim function
is implemented in the Microsoft.VisualBasic namespace for backward
compatability. If you use Reflector you'll find that the internal
implementation begins with the following check.

If ((str Is Nothing) OrElse (str.Length = 0)) Then
Return ""
End If

Now, I realize this call does the "work" for you, but, assume you (or
someone else)wants to convert the project to another .net language.
C# for instance does not implement a global Trim() method. The
developers porting your code are then forced** to change every
reference to Trim() to either a utility function or to the native
framework methods. It's best to just conform and avoid the backward
compatible functions.


** The conversion utility may make this change for you.

"Terry Olsen" wrote:


Alright, I've been seeing people rant and rave about no using the VisualBasic namespace in a VB application and that it is there for
backward compatibility (which I don't agree with. I will agree that VisualBasic.Compatibility is). My question is this, why chose
VB as a language and then go out of your way to avoid using the features built into the language via the VisualBasic namespace. I
just don't get it. If one wants to write a c# app, why not just do it in c#? Perhaps I don't get it because I have been writing VB
apps using MS dialects of Basic since 1982. The day I stop using the VisualBasic Namespace (excluding the .Compatibility) is the
day I stop writing in VB.

Just My $0.02.
--
Al Reid



.



Relevant Pages

  • Re: trim(string) vs string.trim
    ... namespace is a part of the .net framework. ... proffesional programming language I don't know if that is still the same. ... Microsoft.VisualBasic namespace is in Net the same as the System.Net.Data ... a utility class and perform your trim there, even if you use the Trim ...
    (microsoft.public.dotnet.languages.vb)
  • Re: trim(string) vs string.trim
    ... programlanguages more books.The writters build have build around that their ... proffesional programming language I don't know if that is still the same. ... Microsoft.VisualBasic namespace is in Net the same as the System.Net.Data ... a utility class and perform your trim there, even if you use the Trim ...
    (microsoft.public.dotnet.languages.vb)
  • Re: PHP global namespace clogged up
    ... > pointed out in your many posts, is that they need to maintain backward ... > compatibility. ... ``To clean up the existing mess, ...
    (comp.lang.php)
  • Re: Which DL to use
    ... the file format was changed between Word ... documents and display Word 2007 fonts, you will need the compatibility ... Word MVP web site http://word.mvps.org ... being backward compatible.... ...
    (microsoft.public.word.docmanagement)
  • Re: Arghhh...strict, but not strict enough
    ... The VB runtime not only includes familiar functions like UCase and MsgBox, but also a host of helper functions that the compiler uses. ... Note that the VB runtime is different than the compatibility library, which you should reference only when you need it. ... The Microsoft.VisualBasic namespace, however, provides the runtime functions for Visual Basic. ... I can understand how to do LEFT, VAL etc using the dotnet framework, rather than the comfortable old VB way, all whilst in the safety of VB. ...
    (microsoft.public.dotnet.languages.vb)