BAD CODE
Dim f As System.Windows.Forms.Form
f.ShowModal()
GOOD CODE
Dim f As System.Windows.Forms.Form = New System.Windows.Forms.Form
' Dim f As New System.Windows.Forms.Form ' alternative syntax
f.ShowModal()
EVEN BETTER CODE
(Ensure proper disposal of IDisposable object more info)
Us...
Function TestFunction() As TestClass
Return Nothing
End Function
BAD CODE
TestFunction().TestMethod()
GOOD CODE
Dim x = TestFunction()
If x IsNot Nothing Then x.TestMethod()
14.0
Null Conditional Operator
TestFunction()?.TestMethod()