In visual studio 2008, when I use something akin to the following snippet:
Dim myVar
.... ' all sorts of stuff that might initialise myVar '
if not isNothing(myVar) then
myVar = new Object()
end if
myVar.ToString()
visual studio warns me on the last statement that myVar might be uninitialised, and a nullreference exception could occur.
To me it seems desirable to suppress that message in this situation.
- Am I right in wanting to suppress that warning here, or am I overlooking something?
- Is it possible to suppress a warning here.
Note that I don't want to suppress the warning in general, only if I'm sure it makes no sense here.