Given the following code:
Private Sub ButtonShowTheIn tValue_Click(By Val sender As System.Object, ByVal e
As System.EventArg s) Handles ButtonShowTheIn tValue.Click
MsgBox(String.F ormat("TheClass Instance.TheInt = {0:G}",
TheClassInstanc e.TheInt))
End Sub
The code above displays a simple message box that shows the value of the field
TheInt in the object TheClassInstanc e. If I rename the object or the field in
it's declaration I'll get an easily fixable error. However, there's the risk
of correcting the name of the variable, but leaving the string literal
unchanged. Is there somehow a way to replace the string literal
"TheClassInstan ce.TheInt" with a variable so that I would get a compilation
error if the field's name was to be changed in its declaration?
Private Sub ButtonShowTheIn tValue_Click(By Val sender As System.Object, ByVal e
As System.EventArg s) Handles ButtonShowTheIn tValue.Click
MsgBox(String.F ormat("TheClass Instance.TheInt = {0:G}",
TheClassInstanc e.TheInt))
End Sub
The code above displays a simple message box that shows the value of the field
TheInt in the object TheClassInstanc e. If I rename the object or the field in
it's declaration I'll get an easily fixable error. However, there's the risk
of correcting the name of the variable, but leaving the string literal
unchanged. Is there somehow a way to replace the string literal
"TheClassInstan ce.TheInt" with a variable so that I would get a compilation
error if the field's name was to be changed in its declaration?
Comment