[thelist] ASP.NET Weird If-Then thing with Is Nothing

Joshua Olson joshua at waetech.com
Fri Aug 12 09:19:31 CDT 2005


> -----Original Message-----
> From: VOLKAN ÖZÇELIK
> Sent: Friday, August 12, 2005 2:37 AM
> 
> There is no such thing as Nothing on the C# side, since the VB.Net
> code has to be converted to CLR code it's quite probable that MS
> should have removed Nothing from their list of keywords as well.
> 
> Again mentioning that I have not written any single line of VB.Net
> code but I know VBScript well enough; I think Null and Nothing might
> have been merged into a single thing : Null.

Volkan,

Kinda sorta.  There are two types of null that you will more than likely
encounter:

1.  An object variable that doesn't reference an object.  In ASP/VB Script
days, this was known as "Nothing".
2.  A null value coming from the database--aka, an uninitialized field.

The CLR has wisely, in my opinion, created a specific type to refer to #2.
System.DBNull. [0]  This like provides a decent explanation of why this
DBNull exists.  A snippet:

"In database applications, a null object is a valid value for a field. This
class differentiates between a null value (a null object) and an
uninitialized value (the DBNull.Value instance). For example, a table can
have records with uninitialized fields. By default, these uninitialized
fields have the DBNull value."

Cheers.

[0]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemdbnullclasstopic.asp

<><><><><><><><><><>
Joshua L. Olson
WAE Tech Inc.
http://www.waetech.com/
Phone: 706.210.0168 
Fax: 413.812.4864

Monitor bandwidth usage on IIS6 in real-time:
http://www.waetech.com/services/iisbm/




More information about the thelist mailing list