R
rowe_newsgroups
I just noticed this about value types and return values, and it kind
of bugs me that the compiler won't treat it as an error, even with
Option Strict On.
Try this out:
Option Strict On
Public Class MyClass
Private Sub ExtractionSettings_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox(MyProp.ToString())
End Sub
ReadOnly Property MyProp() As Int16
Get
End Get
End Property
End Class
This will compile and run perfectly fine (if I typed it right ),
always showing 0 in the opening messagebox. I really wish that the IDE
would tell me that I didn't explicitly specify a return value for
MyProp. (Yes, I know it's a value type and therefore it has a value of
0 at instantiation so it is returning a value, and thus not violating
the return value rules).
Is there a setting I missed somewhere that I could use to flag this as
an error?
Thanks,
Seth Rowe
of bugs me that the compiler won't treat it as an error, even with
Option Strict On.
Try this out:
Option Strict On
Public Class MyClass
Private Sub ExtractionSettings_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox(MyProp.ToString())
End Sub
ReadOnly Property MyProp() As Int16
Get
End Get
End Property
End Class
This will compile and run perfectly fine (if I typed it right ),
always showing 0 in the opening messagebox. I really wish that the IDE
would tell me that I didn't explicitly specify a return value for
MyProp. (Yes, I know it's a value type and therefore it has a value of
0 at instantiation so it is returning a value, and thus not violating
the return value rules).
Is there a setting I missed somewhere that I could use to flag this as
an error?
Thanks,
Seth Rowe