Given the following code:
Private Sub ButtonShowTheIntValue_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles ButtonShowTheIntValue.Click
MsgBox(String.Format("TheClassInstance.TheInt = {0:G}",
TheClassInstance.TheInt))
End Sub
The code above displays a simple message box that shows the value of the field
TheInt in the object TheClassInstance. 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
"TheClassInstance.TheInt" with a variable so that I would get a compilation
error if the field's name was to be changed in its declaration?