Hi,
I've created a console app in VB.NET 2005 that consists of :
Sub Main()
Dim x As DateTime
x = x.Now
End Sub
I get the following warning:
Access of shared member, constant member, enum member or nested type through
an instance; qualifying expression will not be evaluated.
The warning itself makes sense mostly. There's no reason for me to use an
object instance to access a shared member. However, it states that the
qualifying expression will not be evaluated. This does not seem to be the
case. I get an accurate result with this code; the same result I get with x =
datetime.now . Is this warning inaccurate? Also, what is the harm in using an
object to access a shared member? If you've already got a datetime variable
for whatever reason, why is it discouraged to use it rather than the datetime
type to access the 'now' property?
-Ben