Convert.ToString(), .ToString() and (string)
All these are used for converting an object into a string, but they differ the way they handle NULL values.
>> Convert.ToString() returns String.Empty while attempting to convert a NULL object into a string.
>> .ToString() throws an exception in such cases
>> While, (string) cast sets a string variable as "null" value, and do not throw any exception, but if you try to access any property, method it throws an exception.
Showing posts with label (string). Show all posts
Showing posts with label (string). Show all posts
Wednesday, April 11, 2012
Subscribe to:
Comments (Atom)