Re: Checking for A Blank String

Tech-Archive recommends: Fix windows errors by optimizing your registry



Göran,

"Göran Andersson" <guffa@xxxxxxxxx> schrieb:
Why should using 'Len' be "less robust" (whatever that means)? The behavior of 'Len' is well-known to anybody using BASIC for years and it's documented too. Additionally, 'Len' is a 1st class citizen in VB. 'Len' feels much more natural in VB than the "low-level" method 'IsNullOrEmpty', especially because the term/keyword 'null' is not used in VB.

We are now in VB.NET, not in VB6. What was is no longer. In .NET the members of the System namespace is the first class citizens.

Who's defining that? In VB.NET both the VB Runtime Library and the .NET Framework Class Library are fist class citizens and there is no general rule when to prefer one over the other.

Trying to avoid the use of VB's intrinsic functions is like trying to use a screwdriver to screw in a nail although there is a hammer in the toolbox for the reason that "a screwdriver is a more professional tool than a hammer."

That would be true if the .NET alternative was significantly less suited for what you are trying to do.

In this case it's actually the opposite. The .NET alternative does exactly what you want to do, while the VB6-like alternative returns a value that has to be analysed to come to the same result.

Re-read my post. I gave a technical reason why I am preferring 'Len' in this particular case.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

.