![]() |
|
|
| Subject:
VB.net null reference testing
Category: Computers > Programming Asked by: sceleratus-ga List Price: $2.00 |
Posted:
25 Apr 2004 06:52 PDT
Expires: 25 Apr 2004 17:41 PDT Question ID: 335856 |
|
| There is no answer at this time. |
|
| Subject:
Re: VB.net null reference testing
From: dotnethelp-ga on 25 Apr 2004 14:38 PDT |
Sceleratus-
.Net most definatly supports Null reference types (and checking for Null)
Quick example
VB:
Dim obj As Object = Nothing
If Not obj = Nothing Then
MessageBox.Show("Is Not Nothing")
Else
MessageBox.Show("Is Nothing")
End If
C#:
object obj = null;
if(obj != null)
{
MessageBox.Show("Is Not Nothing")
}
else
{
MessageBox.Show("Is Nothing")
}
When you say ".Net does not support direct testing for null", I think
you may be refering to ADO.NET.
If your have a field in a ADO.NET table that is null you have to compare its
value against System.DBNull.Value, you cannot do a direct test against
null (or nothing). However this does not affect you here.
Regards,
Brett |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
| Search Google Answers for |
| Google Home - Answers FAQ - Terms of Service - Privacy Policy |