Re: Selecting Proper Variables

From: Cor Ligthert (notfirstname_at_planet.nl)
Date: 08/29/04


Date: Sun, 29 Aug 2004 16:23:08 +0200

OK

We have no difference in my opinion about that, I did not understand that
you was meaning "it can be" a null reference.

Therefore I use as well as Armin said String = ""

(As about in reallity about of course for very few things)

:-)

Cor

> >>
> >> They are not the same, 'Nothing' is a null reference, 'Empty', or '""'
> >> are not.
> >>
> > did I write Is Nothing?
> > Although = Nothing acts the same as Is nothing when there is no
reference.
>
> \\\
> Dim s1 As String = String.Empty
> MsgBox(s1.Length) ' 0.
> Dim s2 As String = Nothing
> MsgBox(s2.Length) ' 'NullReferenceException'.
> ///
>
> That's what I was talking about. If you compare a string that is
> holding a null reference to 'String.Empty', you will receive a 'True' as
> the result of the comparison. Nevertheless, both string variables
> behave differently.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>



Relevant Pages

  • Re: empty vs null
    ... The documentation you refer to is for the System.String type, ... though they moved to being immutable reference types. ... to Vb.NET, suddenly we could actually compare string references, and at the same ... > references compare equal to each other. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Selecting Proper Variables
    ... > Although = Nothing acts the same as Is nothing when there is no reference. ... Dim s1 As String = String.Empty ... If you compare a string that is ...
    (microsoft.public.dotnet.languages.vb)
  • Re: determining if a string is null
    ... a String is null, because there isn't a String there at all. ... you have a reference, and that reference is *capable* of pointing to a ... but the whole meaning of 'null' is that there is no String ...
    (comp.lang.java.programmer)
  • Re: What is the purpose of the string.copy method?
    ... Meaning it get's a reference to the string object, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: formula validation
    ... I need to be able to reference the formula ... in the cell and compare it to a string containing the formula. ...
    (microsoft.public.excel.programming)