A null value is a value that doesn't refer to any object. It's the default value of reference-type variables(e.g., class, interface, delegate, string).
For example:
string sTest = "Test";
if (sTest == null) {
Console.WriteLine("sTest is Null")
}
This code works without any problems with C#,but there's no VB.NET equivalent of the null keyword. Instead,VB.NET uses the Nothing keyword. The following code demonstrates its use:
Dim sTest As String
If (sTest Is Nothing) Then
Console.WriteLine("sTest is Null")
End If
No comments:
Post a Comment