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: Terminal application compatibility
    ... > compatibility doesn't seem to be OS X biggest strength. ... requiring slavish backward compatibility leads ... macos9 and earlier to be dead, dead, dead. ... apple would have been in better shape if it had been done five years ...
    (comp.sys.mac.programmer.help)
  • Re: net 3 replaces net 1?
    ... official message from Microsoft. ... in fact upwards compatibility.. ... old bugs was concerned in. ... in my eyes that say that they cannot be resolved because of backward ...
    (microsoft.public.dotnet.general)