Re: Selecting Proper Variables
From: Herfried K. Wagner [MVP] (hirf-spam-me-here_at_gmx.at)
Date: 08/29/04
- Next message: Herfried K. Wagner [MVP]: "Re: Selecting Proper Variables"
- Previous message: Herfried K. Wagner [MVP]: "Re: Get Folder"
- In reply to: Cor Ligthert: "Re: Selecting Proper Variables"
- Next in thread: Cor Ligthert: "Re: Selecting Proper Variables"
- Reply: Cor Ligthert: "Re: Selecting Proper Variables"
- Messages sorted by: [ date ] [ thread ]
Date: 29 Aug 2004 15:57:53 +0200
* "Cor Ligthert" <notfirstname@planet.nl> scripsit:
>>> MyString.empty
>>> myString = Nothing
>>> myString = ""
>>> Are all the same
>>
>> 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/>
- Next message: Herfried K. Wagner [MVP]: "Re: Selecting Proper Variables"
- Previous message: Herfried K. Wagner [MVP]: "Re: Get Folder"
- In reply to: Cor Ligthert: "Re: Selecting Proper Variables"
- Next in thread: Cor Ligthert: "Re: Selecting Proper Variables"
- Reply: Cor Ligthert: "Re: Selecting Proper Variables"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|