Connecting Tech Pros Worldwide Forums | Help | Site Map

Difference between "" and null

Ganesh9u's Avatar
Newbie
 
Join Date: Oct 2008
Location: INDIA
Posts: 23
#1: Oct 4 '08
Difference between null and "" with memory information
thanks

insertAlias's Avatar
Forum Leader
 
Join Date: Apr 2008
Location: San Antonio, TX (USA)
Posts: 2,608
#2: Oct 4 '08

re: Difference between "" and null


Please take time to research these basic questions yourself.

from MSDN
Quote:
The null keyword is a literal that represents a null reference, one that does not refer to any object. null is the default value of reference-type variables.

and "" is just an empty string literal, exactly the same as any other string.
Ganesh9u's Avatar
Newbie
 
Join Date: Oct 2008
Location: INDIA
Posts: 23
#3: Oct 6 '08

re: Difference between "" and null


Quote:

Originally Posted by insertAlias

"" is just an empty string literal, exactly the same as any other string.

Thanks ..
Member
 
Join Date: Jul 2008
Posts: 36
#4: Oct 6 '08

re: Difference between "" and null


"" is a String object, that is stored inside your code somewhere. When
you have a variable (string theVar = ""), it has type String and its value
is reference to the string object.

null is an indicator that a reference value (String, or any other object type) does
not exist i.e. if you have variable, it has type (for example DataGridView) but
it does no refer to any object.

To make you more confused: think about DBNull.Value
Ganesh9u's Avatar
Newbie
 
Join Date: Oct 2008
Location: INDIA
Posts: 23
#5: Oct 15 '08

re: Difference between "" and null


Hi guys, Thanks for all your posts. Thanks a lot.
Reply