Difference between "" and null

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ganesh9u
    New Member
    • Oct 2008
    • 23

    Difference between "" and null

    Difference between null and "" with memory information
    thanks
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    Please take time to research these basic questions yourself.

    from MSDN
    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.

    Comment

    • Ganesh9u
      New Member
      • Oct 2008
      • 23

      #3
      Originally posted by insertAlias
      "" is just an empty string literal, exactly the same as any other string.
      Thanks ..
      Last edited by Frinavale; Oct 6 '08, 07:44 PM. Reason: fixed quote

      Comment

      • artov
        New Member
        • Jul 2008
        • 40

        #4
        "" 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

        Comment

        • Ganesh9u
          New Member
          • Oct 2008
          • 23

          #5
          Hi guys, Thanks for all your posts. Thanks a lot.

          Comment

          Working...