If myObject Is Nothing Then
'...
End If
Dim X As ArrayList
X.Add("Hello world!")
Dim X As New ArrayList
Logic error:
VB.NET:If myObject Is Nothing Then '... End If
If you meant to test if the object was NOT nothing (i.e. "If myObject IsNot Nothing"), that could be considered a simple logic error.
Run time error:
VB.NET:Dim X As ArrayList X.Add("Hello world!")
If ArrayList had a Shared "Add" method, then there would be no runtime error. But it doesn't, so you need to declare it with "Dim ... As New ArrayList"
I'd actually expect that to raise a compiler warning or error "Use of un-instanciated variable X"
Yeah, but that's kinda silly.. Youre right, but what are you going to do..
Variable 'X' is used before it has been assigned a value. A null reference exception could result at runtime.
I couldnt remember the exact error message, but I was sure i'd seen it.Not in VS 2005 at least.
Public Class MyClass
Private X As ArrayList
Public Sub New()
X.Add("Test")
End Sub
End Class
Basically that error is telling you that you have not declared anything for "s". It knows it is a string object, but it doesnt hold any value.
Umm, what? I think you're confused.
"MyClass" is a reserved keyword, geddit?Umm, what?